Skip to content

Commit

Permalink
Build alphafold3 container
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaMolod committed Jan 22, 2025
1 parent 6c43bac commit 1cf7c81
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 1 deletion.
34 changes: 33 additions & 1 deletion .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build-and-test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -132,6 +132,38 @@ jobs:
tags: ${{ secrets.DOCKER_USERNAME }}/alphalink:${{ github.event.release.tag_name }}
ssh: default

build-alphafold3-container:
runs-on: ubuntu-latest
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v4
- run: rm -rf /opt/hostedtoolcache
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-buildx-action@v3
- name: Build and push alphafold3 container
if: github.event_name == 'push'
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/alphafold3.dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/alphafold3:latest
ssh: default
- name: Build and push alphafold3 container with version
if: github.event_name == 'release' && github.event.action == 'published'
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/alphafold3.dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/alphafold3:${{ github.event.release.tag_name }}
ssh: default

build-analysis-container:
runs-on: ubuntu-latest
steps:
Expand Down
86 changes: 86 additions & 0 deletions docker/alphafold3.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM nvidia/cuda:12.6.0-base-ubuntu22.04

# ---------------------------------------------------------
# 1. System Packages Installation
# ---------------------------------------------------------
RUN apt-get update -q && \
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \
software-properties-common \
git \
wget \
gcc \
g++ \
make \
zlib1g-dev \
zstd \
&& rm -rf /var/lib/apt/lists/*

# ---------------------------------------------------------
# 2. Miniforge Installation
# ---------------------------------------------------------
RUN wget -q -P /tmp https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh && \
bash /tmp/Miniforge3-Linux-x86_64.sh -b -p /opt/conda && \
rm /tmp/Miniforge3-Linux-x86_64.sh
ENV PATH="/opt/conda/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/conda/lib:$LD_LIBRARY_PATH"

# ---------------------------------------------------------
# 3. Conda + Mamba Environment
# ---------------------------------------------------------
RUN conda install --solver=classic -y \
conda-forge::conda-libmamba-solver \
conda-forge::libmamba \
conda-forge::libmambapy \
conda-forge::libarchive \
conda-forge::git && \
mamba install -y -c conda-forge -c bioconda -c omnia --solver classic \
openmm==8.0 \
pdbfixer==1.9 \
kalign2 \
modelcif \
pip \
hmmer \
hhsuite \
python=3.11 && \
conda clean --all --force-pkgs-dirs --yes

# ---------------------------------------------------------
# 4. SSH and GitHub Known Host
# ---------------------------------------------------------
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts

# ---------------------------------------------------------
# 5. Clone AlphaPulldown & Install
# ---------------------------------------------------------
RUN --mount=type=ssh git clone --recurse-submodules [email protected]:KosinskiLab/AlphaPulldown.git
WORKDIR /AlphaPulldown
RUN pip3 install .

# ---------------------------------------------------------
# 6. Additional Python Tools
# ---------------------------------------------------------
RUN pip3 install --upgrade pip --no-cache-dir && \
pip3 install --upgrade --no-cache-dir \
pytest \
"jax[cuda12]" && \
chmod u+s /sbin/ldconfig.real

# ---------------------------------------------------------
# 7. AlphaFold 3 Source & Dependencies
# ---------------------------------------------------------
COPY . /app/alphafold
WORKDIR /app/alphafold
RUN pip3 install -r dev-requirements.txt && \
pip3 install --no-deps . && \
build_data

# ---------------------------------------------------------
# 8. Environment for XLA
# ---------------------------------------------------------
# For GPUs < 8.0 compute capability, see note in Dockerfile
ENV XLA_FLAGS="--xla_gpu_enable_triton_gemm=false"
ENV XLA_PYTHON_CLIENT_PREALLOCATE=true
ENV XLA_CLIENT_MEM_FRACTION=0.95

ENTRYPOINT ["bash"]

0 comments on commit 1cf7c81

Please sign in to comment.