-
Notifications
You must be signed in to change notification settings - Fork 7
Description
It would be convenient to have a container, such as a docker container, that includes all of the software and data needed to apply the MELD classifier to a subject.
An example of a Dockerfile that would build such an environment is here:
FROM ubuntu:jammy AS FCDDetection
ENV DEBIAN_FRONTEND="noninteractive"
Update the ubuntu.
RUN apt-get -y update &&
apt-get -y upgrade
Install the prerequisite software
RUN apt-get install -y build-essential
apt-utils
vim
nano
curl
wget
pip
python3
git
Install freesurfer in /opt/freesurfer.
RUN mkdir -p /freesurfertar
&& curl -SL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-linux-ubuntu22_amd64-7.3.2.tar.gz
| tar -xzC /freesurfertar
&& mv /freesurfertar/freesurfer /opt/
&& rmdir /freesurfertar
This will also need to be configured in the running docker container.
This modifies only the build environment.
ENV PATH=/opt/freesurfer/bin:$PATH
RUN echo "PATH=/opt/freesurfer/bin:$PATH" >> ~/.bashrc
ENV FREESURFER_HOME=/opt/freesurfer
RUN echo "FREESURFER_HOME=/opt/freesurfer" >> ~/.bashrc
Install miniconda
ENV CONDA_DIR /opt/conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh &&
/bin/bash ~/miniconda.sh -b -p /opt/conda
Put conda in path so we can use conda activate
ENV PATH=$CONDA_DIR/bin:$PATH
Update to the newest version of conda:
RUN conda update -n base -c defaults conda
RUN conda init bash
checkout and install the github repo
RUN cd / && git clone https://github.com/MELDProject/meld_classifier.git
enter the meld_classifier directory
create the meld classifier environment with all the dependencies
SHELL ["/bin/bash", "-c"]
RUN cd /meld_classifier && conda env create -f environment.yml
RUN cd /meld_classifier && conda run -n meld_classifier /bin/bash -c "pip install -e ."
Use the bash shell this way because conda cant activate.
#SHELL ["conda", "run", "-n", "meld_classifier", "/bin/bash", "-c"]
Configure MELD for this docker image:
COPY ./meld_config.ini /meld_classifier/meld_config.ini
RUN mkdir /MELD-data
RUN conda run --no-capture-output -n meld_classifier /bin/bash -c " python3 /meld_classifier/scripts/prepare_classifier.py --skip-config"
COPY user-freesurfer-license.txt ${FREESURFER_HOME}/.license
RUN cd /meld_classifier && conda run --no-capture-output -n meld_classifier /bin/bash -c " pytest "