Dockerfile 3.34 KB
Newer Older
Augustin-Zidek's avatar
Augustin-Zidek committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

15
ARG CUDA=11.1.1
Tim Green's avatar
Tim Green committed
16
FROM nvidia/cuda:${CUDA}-cudnn8-runtime-ubuntu18.04
Augustin-Zidek's avatar
Augustin-Zidek committed
17
18
19
20
21
# FROM directive resets ARGS, so we specify again (the value is retained if
# previously set).
ARG CUDA

# Use bash to support string substitution.
22
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Augustin-Zidek's avatar
Augustin-Zidek committed
23

24
25
RUN apt-get update \ 
    && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
26
27
        build-essential \
        cmake \
28
        cuda-command-line-tools-$(cut -f1,2 -d- <<< ${CUDA//./-}) \
29
30
31
32
33
        git \
        hmmer \
        kalign \
        tzdata \
        wget \
34
35
36
    && rm -rf /var/lib/apt/lists/* \
    && apt-get autoremove -y \
    && apt-get clean
Augustin-Zidek's avatar
Augustin-Zidek committed
37
38
39

# Compile HHsuite from source.
RUN git clone --branch v3.3.0 https://github.com/soedinglab/hh-suite.git /tmp/hh-suite \
40
41
42
    && mkdir /tmp/hh-suite/build \
    && pushd /tmp/hh-suite/build \
    && cmake -DCMAKE_INSTALL_PREFIX=/opt/hhsuite .. \
Augustin-Zidek's avatar
Augustin-Zidek committed
43
44
    && make -j 4 && make install \
    && ln -s /opt/hhsuite/bin/* /usr/bin \
45
    && popd \
Augustin-Zidek's avatar
Augustin-Zidek committed
46
47
    && rm -rf /tmp/hh-suite

Augustin Zidek's avatar
Augustin Zidek committed
48
# Install Miniconda package manager.
Augustin-Zidek's avatar
Augustin-Zidek committed
49
50
51
52
53
54
55
RUN wget -q -P /tmp \
  https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
    && rm /tmp/Miniconda3-latest-Linux-x86_64.sh

# Install conda packages.
ENV PATH="/opt/conda/bin:$PATH"
Augustin Zidek's avatar
Augustin Zidek committed
56
RUN conda install -qy conda==4.13.0 \
Augustin-Zidek's avatar
Augustin-Zidek committed
57
58
    && conda install -y -c conda-forge \
      openmm=7.5.1 \
DeepMind's avatar
DeepMind committed
59
      cudatoolkit==${CUDA_VERSION} \
Augustin-Zidek's avatar
Augustin-Zidek committed
60
      pdbfixer \
61
      pip \
62
63
      python=3.7 \
      && conda clean --all --force-pkgs-dirs --yes
Augustin-Zidek's avatar
Augustin-Zidek committed
64
65
66
67
68
69

COPY . /app/alphafold
RUN wget -q -P /app/alphafold/alphafold/common/ \
  https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt

# Install pip packages.
70
71
72
RUN pip3 install --upgrade pip --no-cache-dir \
    && pip3 install -r /app/alphafold/requirements.txt --no-cache-dir \
    && pip3 install --upgrade --no-cache-dir \
73
74
      jax==0.3.17 \
      jaxlib==0.3.15+cuda11.cudnn805 \
75
      -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
Augustin-Zidek's avatar
Augustin-Zidek committed
76
77

# Apply OpenMM patch.
78
WORKDIR /opt/conda/lib/python3.7/site-packages
Augustin-Zidek's avatar
Augustin-Zidek committed
79
80
RUN patch -p0 < /app/alphafold/docker/openmm.patch

Augustin Zidek's avatar
Augustin Zidek committed
81
82
83
# Add SETUID bit to the ldconfig binary so that non-root users can run it.
RUN chmod u+s /sbin/ldconfig.real

Augustin-Zidek's avatar
Augustin-Zidek committed
84
85
86
87
88
89
90
91
92
93
94
# We need to run `ldconfig` first to ensure GPUs are visible, due to some quirk
# with Debian. See https://github.com/NVIDIA/nvidia-docker/issues/1399 for
# details.
# ENTRYPOINT does not support easily running multiple commands, so instead we
# write a shell script to wrap them up.
WORKDIR /app/alphafold
RUN echo $'#!/bin/bash\n\
ldconfig\n\
python /app/alphafold/run_alphafold.py "$@"' > /app/run_alphafold.sh \
  && chmod +x /app/run_alphafold.sh
ENTRYPOINT ["/app/run_alphafold.sh"]