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 25bd52d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ 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:
Expand Down Expand Up @@ -52,10 +56,26 @@ 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
cache-to: type=gha,mode=max,scope=loris-mri

# TODO: Move as much as possible of this in the MRI dockerfile
- name: Mount imaging files S3 bucket
run: |
sudo apt-get update
sudo apt-get install -y s3fs fuse kmod
sudo modprobe fuse
sudo mkdir /data-imaging
touch .passwd-s3fs
chmod 600 .passwd-s3fs
echo ${{ env.BUCKET_ACCESS_KEY }}:${{ env.BUCKET_SECRET_KEY }} > .passwd-s3fs
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
- name: Run integration tests
run: docker compose --file ./test/docker-compose.yml run mri pytest python/tests/integration
2 changes: 2 additions & 0 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
retries: 5
mri:
image: loris-mri
volumes:
- /data-imaging:/data-imaging
depends_on:
db:
condition: service_healthy
27 changes: 14 additions & 13 deletions test/mri.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@ 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

# Install the DICOM Toolkit
RUN apt-get install -y dcmtk
# - `s3fs` is used to mount the imaging files on the file system
# - `wget` is used by some installation commands
RUN apt-get install -y sudo wget

########################
# Install MINC Toolkit #
Expand Down Expand Up @@ -70,7 +63,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 && \
Expand Down Expand Up @@ -117,3 +111,10 @@ ENV LORIS_MRI=/opt/${PROJECT}/bin/mri
ENV PYTHONPATH=$PYTHONPATH:/opt/${PROJECT}/bin/mri/python:/opt/${PROJECT}/bin/mri/python/react-series-data-viewer

Check warning on line 111 in test/mri.Dockerfile

View workflow job for this annotation

GitHub Actions / Docker

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$PYTHONPATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
ENV BEASTLIB=${MINC_TOOLKIT_DIR}/../share/beast-library-1.1
ENV MNI_MODELS=${MINC_TOOLKIT_DIR}/../share/icbm152_model_09c

#######################
# Mount imaging files #
#######################

# TODO: Move mount logic from GitHub action to here.
ENTRYPOINT ls /data-imaging

Check warning on line 120 in test/mri.Dockerfile

View workflow job for this annotation

GitHub Actions / Docker

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for ENTRYPOINT to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

0 comments on commit 25bd52d

Please sign in to comment.