From 1c0919634d927f8b84d7a8f4444e66f565ff1091 Mon Sep 17 00:00:00 2001 From: Maxime Mulder Date: Fri, 18 Oct 2024 15:53:38 -0400 Subject: [PATCH] add s3fs in docker --- .github/workflows/integration.yml | 30 ++++++++++++++++++++++++- test/mri.Dockerfile | 37 +++++++++++++++++++++---------- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 0191801fc..ffec1a578 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -11,12 +11,35 @@ env: DATABASE_NAME: TestDatabase DATABASE_USERNAME: TestUsername DATABASE_PASSWORD: TestPassword + BUCKET_URL: https://ace-minio-1.loris.ca:9000 + BUCKET_NAME: loris-rb-data + BUCKET_ACCESS_KEY: lorisadmin + BUCKET_SECRET_KEY: dmwCdAZJ=9HwMte jobs: docker: name: Docker runs-on: ubuntu-latest steps: + - name: Mount raisinbread data + run: | + sudo apt-get update + sudo apt-get install -y s3fs fuse kmod + echo "AAA" + sudo modprobe fuse + echo "BBB" + sudo mkdir /data-imaging + echo "CCC" + touch .passwd-s3fs + chmod 600 .passwd-s3fs + echo "DDD" + sudo echo ${{ env.BUCKET_ACCESS_KEY }}:${{ env.BUCKET_SECRET_KEY }} > .passwd-s3fs + echo "EEE" + sudo s3fs ${{ env.BUCKET_NAME }} /data-imaging -o passwd_file=.passwd-s3fs -o url=${{ env.BUCKET_URL }} -o use_path_request_style -o allow_other + echo "FFF" + sudo ls /data-imaging + echo "GGG" + - name: Check out LORIS-MRI uses: actions/checkout@v4 @@ -52,10 +75,15 @@ jobs: DATABASE_NAME=${{ env.DATABASE_NAME }} DATABASE_USER=${{ env.DATABASE_USERNAME }} DATABASE_PASS=${{ env.DATABASE_PASSWORD }} + BUCKET_URL=${{ env.BUCKET_URL }} + BUCKET_NAME=${{ env.BUCKET_NAME }} + BUCKET_ACCESS_KEY=${{ env.BUCKET_ACCESS_KEY }} + BUCKET_SECRET_KEY=${{ env.BUCKET_SECRET_KEY }} tags: loris-mri load: true cache-from: type=gha,scope=loris-mri - cache-to: type=gha,scope=loris-mri + allow: security.insecure + cache-to: type=gha,mode=max,scope=loris-mri - name: Run integration tests run: docker compose --file ./test/docker-compose.yml run mri pytest python/tests/integration diff --git a/test/mri.Dockerfile b/test/mri.Dockerfile index f4eb90c48..6bc253aca 100644 --- a/test/mri.Dockerfile +++ b/test/mri.Dockerfile @@ -7,21 +7,29 @@ RUN apt-get update # Install utilities # ##################### -# Update the package list and install build-essential, checkinstall, and cmake -# Install some general dependencies -RUN apt-get install -y build-essential checkinstall cmake libzip-dev mariadb-client - -# Install Perl and update CPAN -RUN apt-get install -y perl && \ - cpan CPAN +# Install the dependencies of LORIS-MRI +RUN apt-get install -y build-essential checkinstall cmake dcmtk libzip-dev mariadb-client perl # Install utilities -# - `wget` is used by some installation commands # - `sudo` is used by the imaging install script -RUN apt-get install -y wget sudo +# - `s3fs` is used to mount the imaging files on the file system +# - `wget` is used by some installation commands +RUN apt-get install -y s3fs fuse sudo wget kmod -# Install the DICOM Toolkit -RUN apt-get install -y dcmtk +ARG BUCKET_URL +ARG BUCKET_NAME +ARG BUCKET_ACCESS_KEY +ARG BUCKET_SECRET_KEY + +# Connect to the imaging S3 bucket and mount in the LORIS-MRI image +RUN modprobe fuse && \ + mkdir /data-imaging && \ + touch .passwd-s3fs && \ + chmod 600 .passwd-s3fs && \ + echo $BUCKET_ACCESS_KEY:$BUCKET_SECRET_KEY > .passwd-s3fs && \ + s3fs $BUCKET_NAME /data-imaging -o passwd_file=.passwd-s3fs -o url=$BUCKET_URL -o use_path_request_style -o allow_other + +RUN ls /data-imaging ######################## # Install MINC Toolkit # @@ -70,7 +78,8 @@ RUN dpkg -i /tmp/bic-mni-models-0.1.1-20120421.deb && \ RUN apt-get install -y libmariadb-dev libmariadb-dev-compat # Install the Perl libraries -RUN cpan install Math::Round && \ +RUN cpan CPAN && \ + cpan install Math::Round && \ cpan install DBI && \ cpan install DBD::mysql@4.052 && \ cpan install Getopt::Tabular && \ @@ -117,3 +126,7 @@ ENV LORIS_MRI=/opt/${PROJECT}/bin/mri ENV PYTHONPATH=$PYTHONPATH:/opt/${PROJECT}/bin/mri/python:/opt/${PROJECT}/bin/mri/python/react-series-data-viewer ENV BEASTLIB=${MINC_TOOLKIT_DIR}/../share/beast-library-1.1 ENV MNI_MODELS=${MINC_TOOLKIT_DIR}/../share/icbm152_model_09c + +####################### +# Mount imaging files # +#######################