|
| 1 | +# syntax=docker/dockerfile:1.4 |
| 2 | +FROM condaforge/miniforge3:25.11.0-0 AS base |
| 3 | + |
| 4 | +LABEL org.opencontainers.image.source https://github.com/Australian-Protein-Design-Initiative/containers |
| 5 | + |
| 6 | +# Build arguments |
| 7 | +ARG DOWNLOAD_MODELS=true |
| 8 | +ARG GIT_REF=f4c9c14 |
| 9 | + |
| 10 | +# Set environment variables |
| 11 | +ENV DEBIAN_FRONTEND=noninteractive \ |
| 12 | + PYTHONUNBUFFERED=1 \ |
| 13 | + PYTHONDONTWRITEBYTECODE=1 \ |
| 14 | + CUDA_HOME=/usr/local/cuda \ |
| 15 | + PATH=/opt/conda/bin:$PATH \ |
| 16 | + PROTPARDELLE_OUTPUT_DIR=/tmp \ |
| 17 | + PROJECT_ROOT_DIR=/app/protpardelle-1c \ |
| 18 | + PROTPARDELLE_MODEL_PARAMS=/app/protpardelle-1c/model_params |
| 19 | + |
| 20 | +# Install system dependencies |
| 21 | +RUN apt-get update && apt-get install -y \ |
| 22 | + build-essential \ |
| 23 | + wget \ |
| 24 | + curl \ |
| 25 | + git \ |
| 26 | + aria2 \ |
| 27 | + && rm -rf /var/lib/apt/lists/* |
| 28 | + |
| 29 | +# Install huggingface-hub for model downloads |
| 30 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 31 | + pip install "huggingface_hub[cli]" |
| 32 | + |
| 33 | +# Install Foldseek |
| 34 | +RUN wget https://mmseqs.com/foldseek/foldseek-linux-gpu.tar.gz && \ |
| 35 | + tar -xzf foldseek-linux-gpu.tar.gz && \ |
| 36 | + mv foldseek/bin/foldseek /usr/bin/ && \ |
| 37 | + rm -rf foldseek-linux-gpu.tar.gz foldseek |
| 38 | + |
| 39 | +ENV FOLDSEEK_BIN=/usr/bin/foldseek |
| 40 | + |
| 41 | +WORKDIR /app |
| 42 | + |
| 43 | +# Clone the repository |
| 44 | +RUN git clone https://github.com/ProteinDesignLab/protpardelle-1c.git /app/protpardelle-1c && \ |
| 45 | + cd /app/protpardelle-1c && \ |
| 46 | + git checkout ${GIT_REF} |
| 47 | + |
| 48 | +# Setup Python environment and install dependencies |
| 49 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 50 | + cd /app/protpardelle-1c && \ |
| 51 | + pip install torch && \ |
| 52 | + pip install -e . |
| 53 | + |
| 54 | +# Download model weights (conditional) |
| 55 | +RUN --mount=type=cache,target=/models \ |
| 56 | + if [ "$DOWNLOAD_MODELS" = "true" ]; then \ |
| 57 | + cd /app/protpardelle-1c && \ |
| 58 | + # Zenodo seems the be blocking aria2c, so we patch to use wget instead |
| 59 | + sed -i 's/aria2c \-x16 \-s16 \-o/wget -O/' download_model_params.sh && \ |
| 60 | + echo "Downloading model weights..." && \ |
| 61 | + bash download_model_params.sh && \ |
| 62 | + mkdir -p /models && \ |
| 63 | + ln -s /app/protpardelle-1c/model_params /models/protpardelle-1c && \ |
| 64 | + chmod -R a+r /app/protpardelle-1c/model_params && \ |
| 65 | + find /app/protpardelle-1c/model_params -type d -exec chmod a+x {} \;; \ |
| 66 | + else \ |
| 67 | + echo "Skipping model weights download - to use this container please pre-download models to the host and bind them as a volume at /app/protpardelle-1c/model_params"; \ |
| 68 | + fi |
| 69 | + |
| 70 | +# Create wrapper scripts |
| 71 | +RUN printf '#!/bin/sh\nexec python -m protpardelle.sample "$@"\n' > /usr/local/bin/protpardelle-sample && \ |
| 72 | + printf '#!/bin/sh\nexec python -m protpardelle.train "$@"\n' > /usr/local/bin/protpardelle-train && \ |
| 73 | + printf '#!/bin/sh\nexec python -m protpardelle.likelihood "$@"\n' > /usr/local/bin/protpardelle-likelihood && \ |
| 74 | + chmod +x /usr/local/bin/protpardelle-* |
| 75 | + |
| 76 | +# Create non-root user |
| 77 | +RUN useradd -m -u 1001 protpardelle && \ |
| 78 | + mkdir -p /app && \ |
| 79 | + chown -R protpardelle:protpardelle /app |
| 80 | + |
| 81 | +# Switch back to non-root user for final execution |
| 82 | +USER protpardelle |
| 83 | + |
| 84 | +CMD ["protpardelle-sample", "--help"] |
0 commit comments