Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions docker/DOCKER.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## Updating the Lock File

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add documentation about where the current production.lock is generated? Specifically, what kind of instance / system, and any other variables that are relevant to environment resolution.

For my understanding: Do we expect the production.lock to change if the system is a GPU / CPU? Or should it be the same because we specify the same docker base image with CUDA?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point – currently the updating and generation is kind of synonymous (it doesn't say that). And it absolutely is platform specific, as you mentioned in your comments later. Yeah, it's specific to the platform (linux64, arm64, etc). The GPU/CPU point is conditional on what's in the environment.yaml – if that pulls a CPU-version of torch, that's what will be installed in the env.

When you modify `environments/production.yml`, you need to regenerate the lock file to pin exact versions. This ensures reproducible builds.

```bash
# Build the lock file generator image
docker build -f docker/Dockerfile.update-reqs -t openfold3-update-reqs .

# Generate the lock file (linux-64 only for now)
docker run --rm openfold3-update-reqs > environments/production.lock

# Commit the updated lock file
git add environments/production.lock
git commit -m "Update production.lock"
```

## Production images

TODO
Expand All @@ -8,7 +24,7 @@ For Blackwell image build, see [Build_instructions_blackwell.md](Build_instructi

These images are the biggest but come with all the build tooling, needed to compile things at runtime (Deepspeed)

```
```bash
docker build \
-f docker/Dockerfile \
--target devel \
Expand All @@ -17,16 +33,18 @@ docker build \

## Test images

Build the test image
```
Build the test image, with additional test-only dependencies

```bash
docker build \
-f docker/development/Dockerfile \
-f docker/Dockerfile \
--target test \
-t openfold-docker:test .
```

Run the unit tests
```

```bash
docker run \
--rm \
-v $(pwd -P):/opt/openfold3 \
Expand Down
11 changes: 6 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Full performance multi-stage build with complete CUDA toolchain
ARG CUDA_BASE_IMAGE_TAG=12.2.2-cudnn8-devel-ubuntu22.04
ARG CUDA_BASE_IMAGE_TAG=12.1.1-cudnn8-devel-ubuntu22.04
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated and snuck in via #70, turning back to the old version we used

FROM nvidia/cuda:${CUDA_BASE_IMAGE_TAG} AS builder

# Install complete build dependencies including CUDA compiler tools
Expand All @@ -23,9 +23,10 @@ RUN wget -P /tmp \
ENV PATH=/opt/conda/bin:$PATH
ENV CONDA_PREFIX=/opt/conda

# Copy and install dependencies with aggressive cleanup
COPY environments/production.yml /opt/openfold3/environment.yml
RUN mamba env update -n base --file /opt/openfold3/environment.yml \
# Copy and install dependencies from lock file for reproducible builds
# To regenerate the lock file, see docker/DOCKER.md
COPY environments/production.lock /opt/openfold3/production.lock
RUN mamba install -n base --file /opt/openfold3/production.lock \
&& mamba clean --all --yes \
&& conda clean --all --yes

Expand All @@ -52,7 +53,7 @@ ENV TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"
# python3 -c "import deepspeed; print('DeepSpeed ops loaded successfully')"

# Devel stage - use devel image for full CUDA support
ARG CUDA_BASE_IMAGE_TAG=12.2.2-cudnn8-devel-ubuntu22.04
ARG CUDA_BASE_IMAGE_TAG=12.1.1-cudnn8-devel-ubuntu22.04
FROM nvidia/cuda:${CUDA_BASE_IMAGE_TAG} AS devel

# Install devel dependencies
Expand Down
30 changes: 30 additions & 0 deletions docker/Dockerfile.update-reqs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Dockerfile for generating conda environment lock files
# This produces a fully-pinned lock file for reproducible builds
#
# Usage:
# docker build -f docker/Dockerfile.update-reqs -t openfold3-update-reqs .
# docker run --rm openfold3-update-reqs > environments/production.lock

FROM mambaorg/micromamba:1.5.10

USER root

# Install conda-lock
RUN micromamba install -y -n base -c conda-forge conda-lock \
&& micromamba clean --all --yes

USER $MAMBA_USER

COPY --chown=$MAMBA_USER:$MAMBA_USER environments/production.yml /tmp/environment.yml

# Generate explicit lock file for linux-64
# The explicit format is directly consumable by mamba/conda
RUN micromamba run -n base conda-lock lock \
--mamba \
--platform linux-64 \
--file /tmp/environment.yml \
--kind explicit \
--filename-template '/tmp/production-{platform}.lock'

# Output the lock file to stdout when container runs
CMD ["cat", "/tmp/production-linux-64.lock"]
Loading
Loading