Skip to content

Commit

Permalink
add s3fs in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
maximemulder committed Oct 18, 2024
1 parent ac0c0a0 commit 1c09196
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 13 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
37 changes: 25 additions & 12 deletions test/mri.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down Expand Up @@ -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::[email protected] && \
cpan install Getopt::Tabular && \
Expand Down Expand Up @@ -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 #
#######################

0 comments on commit 1c09196

Please sign in to comment.