From 83f1fb483c7c85e77f416efe50c5d7810242c6d4 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Tue, 13 Aug 2024 12:31:17 +0100 Subject: [PATCH] Update dockerfiles --- ...{cryoemservices_relion => class_selection} | 10 +---- Dockerfiles/cryoemservices_cpu | 2 +- Dockerfiles/cryolo | 1 + Dockerfiles/ctffind | 1 + .../{cryoemservices_gpu => motioncor2} | 31 +++++++------- Dockerfiles/motioncor_relion | 42 +++++++++++++++++++ Dockerfiles/motioncorr | 11 ----- Dockerfiles/tomo_align | 29 +++++++++---- 8 files changed, 83 insertions(+), 44 deletions(-) rename Dockerfiles/{cryoemservices_relion => class_selection} (88%) rename Dockerfiles/{cryoemservices_gpu => motioncor2} (51%) create mode 100644 Dockerfiles/motioncor_relion delete mode 100644 Dockerfiles/motioncorr diff --git a/Dockerfiles/cryoemservices_relion b/Dockerfiles/class_selection similarity index 88% rename from Dockerfiles/cryoemservices_relion rename to Dockerfiles/class_selection index 18e19155..6403bf57 100644 --- a/Dockerfiles/cryoemservices_relion +++ b/Dockerfiles/class_selection @@ -1,4 +1,4 @@ -# This Dockerfile is used for class selection and Relion's own motion correction +# This Dockerfile is used for Relion class selection # First stage builds relion FROM rockylinux:8 AS relion-build @@ -23,7 +23,7 @@ RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/downloa RUN bash Mambaforge-$(uname)-$(uname -m).sh -b -p "conda" RUN source "/conda/etc/profile.d/conda.sh" && conda install -c conda-forge conda-pack -RUN source "/conda/etc/profile.d/conda.sh" && source "/conda/etc/profile.d/mamba.sh" && mamba create -c conda-forge -p /install/pythonenv python=3.9 pip libtiff=4.4.0 htcondor pytorch-cpu=1.10.0 numpy=1.25.2 --override-channels -y +RUN source "/conda/etc/profile.d/conda.sh" && source "/conda/etc/profile.d/mamba.sh" && mamba create -c conda-forge -p /install/pythonenv python=3.9 pip libtiff=4.4.0 pytorch-cpu=1.10.0 numpy=1.25.2 --override-channels -y # Install cryoem-services and pipeliner RUN mkdir /install/cryoem-services @@ -60,11 +60,5 @@ ENV PATH="/install/relion4.0/bin:${PATH}" COPY --from=conda-build /install/venv /install/venv ENV PATH="/install/venv/bin:${PATH}" -# Add cryolo files -RUN mkdir -p /dls_sw/apps/EM/crYOLO/phosaurus_models -COPY cryolo_models/* /dls_sw/apps/EM/crYOLO/phosaurus_models - # Change permissions RUN chown -R "${userid}":"${groupid}" install -RUN chown -R "${userid}":"${groupid}" /dls_sw - diff --git a/Dockerfiles/cryoemservices_cpu b/Dockerfiles/cryoemservices_cpu index a8267e9f..7cc333bd 100644 --- a/Dockerfiles/cryoemservices_cpu +++ b/Dockerfiles/cryoemservices_cpu @@ -1,4 +1,4 @@ -# This dockerfile is used for the services that need only cpu and no extra executables +# This Dockerfile is used for the services that can run on CPU FROM python:3.10 ENV VIRTUAL_ENV=/venv diff --git a/Dockerfiles/cryolo b/Dockerfiles/cryolo index 27a4994e..7706e614 100644 --- a/Dockerfiles/cryolo +++ b/Dockerfiles/cryolo @@ -1,3 +1,4 @@ +# This Dockerfile is used for cryolo FROM continuumio/miniconda ARG groupid diff --git a/Dockerfiles/ctffind b/Dockerfiles/ctffind index bfa777c6..94698f6e 100644 --- a/Dockerfiles/ctffind +++ b/Dockerfiles/ctffind @@ -1,3 +1,4 @@ +# This Dockerfile is used for CTFFind4 FROM python:3.10 ENV VIRTUAL_ENV=/venv diff --git a/Dockerfiles/cryoemservices_gpu b/Dockerfiles/motioncor2 similarity index 51% rename from Dockerfiles/cryoemservices_gpu rename to Dockerfiles/motioncor2 index d628d59c..328c3079 100644 --- a/Dockerfiles/cryoemservices_gpu +++ b/Dockerfiles/motioncor2 @@ -1,5 +1,5 @@ -# This Dockerfile is used as a base for the motioncorr and tomo_align Dockerfiles -FROM nvidia/cuda:10.2-devel-centos7 +# This Dockerfile is used for MotionCor2 +FROM nvidia/cuda:12.4.1-runtime-rockylinux8 # Create EM user ARG groupid @@ -12,21 +12,18 @@ RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/downloa RUN bash Mambaforge-$(uname)-$(uname -m).sh -b -p "conda" RUN source "/conda/etc/profile.d/conda.sh" && source "/conda/etc/profile.d/mamba.sh" && mamba create -c conda-forge -p /install/pythonenv python=3.10 pip libtiff=4.4.0 --override-channels -y - RUN chmod -R a+x /install/pythonenv/bin -# Install cryoem-services and ccp-em pipeliner -RUN mkdir /install/cryoem-services && mkdir /install/ccpem-pipeliner +# Install cryoem-services +RUN mkdir /install/cryoem-services COPY packages/cryoem-services /install/cryoem-services -COPY packages/ccpem-pipeliner /install/ccpem-pipeliner -RUN source "/conda/etc/profile.d/conda.sh" && conda activate /install/pythonenv && pip install -e /install/cryoem-services && pip install -e /install/ccpem-pipeliner - -# Add cryolo files -RUN mkdir -p /dls_sw/apps/EM/crYOLO/phosaurus_models -COPY cryolo_models/* /dls_sw/apps/EM/crYOLO/phosaurus_models - -# Change permissions -RUN chown -R "${userid}":"${groupid}" install && chown -R "${userid}":"${groupid}" /dls_sw - -ENV PATH="/install/pythonenv/bin:${PATH}" - +RUN source "/conda/etc/profile.d/conda.sh" && conda activate /install/pythonenv && pip install /install/cryoem-services +RUN chown -R "${userid}":"${groupid}" install +ENV PATH=/install/pythonenv/bin:${PATH} + +# Install MotionCor2 executable +COPY --chown="${userid}":"${groupid}" packages/motioncor-1.4.0 /MotionCor2/1.4.0 +WORKDIR /MotionCor2/1.4.0 +RUN rm MotionCor2 && ln -s MotionCor2_1.4.0_Cuda102 MotionCor2 +ENV PATH=/MotionCor2/1.4.0:${PATH} +RUN chmod +x /MotionCor2/1.4.0 diff --git a/Dockerfiles/motioncor_relion b/Dockerfiles/motioncor_relion new file mode 100644 index 00000000..371debd0 --- /dev/null +++ b/Dockerfiles/motioncor_relion @@ -0,0 +1,42 @@ +# This Dockerfile is used for Relion's own motion correction and Relion postprocessing +# First stage builds relion +FROM rockylinux:8 AS relion-build + +# Get required build packages and libraries +RUN yum install gcc gcc-c++ cmake openmpi -y +RUN yum install fftw-devel libtiff-devel libpng-devel libjpeg-devel zlib-devel -y + +# Build Relion - need to be on the ver4.0 tag +RUN mkdir -p /install/relion4.0 +COPY packages/relion_fork /install/relion_src +RUN mkdir /install/relion_src/build + +RUN cmake -DCMAKE_INSTALL_PREFIX=/install/relion4.0 -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DMPI_C_COMPILER=/usr/lib64/openmpi/bin/mpicc -DMPI_CXX_COMPILER=/usr/lib64/openmpi/bin/mpicxx -DMPI_C_LIBRARIES=/usr/lib64/openmpi/lib/libmpi.so -DMPI_CXX_LIBRARIES=/usr/lib64/openmpi/lib/libmpi.so -DGUI=OFF -DALTCPU=ON -DDoublePrec_CPU=OFF -DFORCE_OWN_FFTW=ON -DAMDFFTW=ON -B/install/relion_src/build -S/install/relion_src +RUN make --directory=/install/relion_src/build/ install + + +# Second stage combines the Relion build with a python environment +FROM rockylinux:9 + +# Create EM user +ARG groupid +ARG userid +ARG groupname +RUN groupadd -r -g "${groupid}" "${groupname}" && useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" + +# Install libraries for Relion +RUN yum install openmpi fftw-devel libtiff-devel libpng-devel libjpeg-devel python3.11 zlib-devel -y + +# Copy Relion +RUN mkdir -p /install/relion4.0 +COPY --from=relion-build /install/relion4.0 /install/relion4.0 +ENV PATH="/install/relion4.0/bin:${PATH}" +RUN chown -R "${userid}":"${groupid}" install + +# Make the python virtual environment and install cryoem-services +ENV VIRTUAL_ENV=/venv +RUN python3.11 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +COPY --chown="${userid}":"${groupid}" packages/cryoem-services ./cryoem-services +RUN python3.11 -m pip install --upgrade pip && python3.11 -m pip install ./cryoem-services + diff --git a/Dockerfiles/motioncorr b/Dockerfiles/motioncorr deleted file mode 100644 index 6ea8f49a..00000000 --- a/Dockerfiles/motioncorr +++ /dev/null @@ -1,11 +0,0 @@ -FROM cryoem-services:gpu - -ARG groupid -ARG userid - -# Install MotionCor2 executable -COPY --chown="${userid}":"${groupid}" packages/motioncor-1.4.0 /MotionCor2/1.4.0 -WORKDIR /MotionCor2/1.4.0 -RUN rm MotionCor2 && ln -s MotionCor2_1.4.0_Cuda102 MotionCor2 -ENV PATH=/MotionCor2/1.4.0:${PATH} -RUN chmod +x /MotionCor2/1.4.0 diff --git a/Dockerfiles/tomo_align b/Dockerfiles/tomo_align index dcb8cc43..e3a4f9c1 100644 --- a/Dockerfiles/tomo_align +++ b/Dockerfiles/tomo_align @@ -1,17 +1,32 @@ -FROM cryoem-services:gpu +# This Dockerfile is used for GPU AreTomo2 processing +FROM nvidia/cuda:12.4.1-runtime-rockylinux8 +# Create EM user ARG groupid ARG userid +ARG groupname +RUN groupadd -r -g "${groupid}" "${groupname}" && useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" + +# Set up conda environment +RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh" +RUN bash Mambaforge-$(uname)-$(uname -m).sh -b -p "conda" + +RUN source "/conda/etc/profile.d/conda.sh" && source "/conda/etc/profile.d/mamba.sh" && mamba create -c conda-forge -p /install/pythonenv python=3.10 pip libtiff=4.4.0 --override-channels -y +RUN chmod -R a+x /install/pythonenv/bin + +# Install cryoem-services +RUN mkdir /install/cryoem-services +COPY packages/cryoem-services /install/cryoem-services +RUN source "/conda/etc/profile.d/conda.sh" && conda activate /install/pythonenv && pip install /install/cryoem-services +RUN chown -R "${userid}":"${groupid}" install +ENV PATH=/install/pythonenv/bin:${PATH} # Install IMOD COPY --chown="${userid}":"${groupid}" packages/imod-4.11.1 /IMOD/4.11.1 -WORKDIR /IMOD/4.11.1 ENV PATH=/IMOD/4.11.1/IMOD/bin/realbin:${PATH} RUN chmod +x /IMOD/4.11.1 # Install AreTomo -COPY --chown="${userid}":"${groupid}" packages/aretomo-1.3.0 /AreTomo/1.3.0 -WORKDIR /AreTomo/1.3.0 -RUN rm AreTomo && ln -s AreTomo_1.3.0_Cuda102_09292022 AreTomo -ENV PATH=/AreTomo/1.3.0:${PATH} -RUN chmod +x /AreTomo/1.3.0 +COPY --chown="${userid}":"${groupid}" packages/AreTomo2 /AreTomo2 +ENV PATH=/AreTomo2:${PATH} +RUN chmod +x /AreTomo2