Skip to content

Commit

Permalink
Update dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-riggs committed Aug 13, 2024
1 parent 30a6b38 commit 83f1fb4
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion Dockerfiles/cryoemservices_cpu
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions Dockerfiles/cryolo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This Dockerfile is used for cryolo
FROM continuumio/miniconda

ARG groupid
Expand Down
1 change: 1 addition & 0 deletions Dockerfiles/ctffind
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This Dockerfile is used for CTFFind4
FROM python:3.10

ENV VIRTUAL_ENV=/venv
Expand Down
31 changes: 14 additions & 17 deletions Dockerfiles/cryoemservices_gpu → Dockerfiles/motioncor2
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
42 changes: 42 additions & 0 deletions Dockerfiles/motioncor_relion
Original file line number Diff line number Diff line change
@@ -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

11 changes: 0 additions & 11 deletions Dockerfiles/motioncorr

This file was deleted.

29 changes: 22 additions & 7 deletions Dockerfiles/tomo_align
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 83f1fb4

Please sign in to comment.