|
| 1 | +# Base image reference: |
| 2 | +# The official Foundry Docker image hosted by Rosetta Commons is available at: |
| 3 | +# https://hub.docker.com/r/rosettacommons/foundry |
| 4 | +# |
| 5 | +# This Dockerfile serves as a reference starting point for building a custom |
| 6 | +# Foundry image. You may optionally exclude checkpoint file downloads to |
| 7 | +# reduce the final image size. |
| 8 | +# |
| 9 | +# Authors: |
| 10 | +# Hope Woods <hope.woods@omsf.io> |
| 11 | +# Rachel Clune <rachel.clune@omsf.io> |
| 12 | +# Sergey Lyskov <sergey.lyskov@gmail.com> |
| 13 | + |
| 14 | +ARG BASE_IMAGE=ubuntu:22.04 |
| 15 | +FROM ${BASE_IMAGE} AS BUILDER |
| 16 | + |
| 17 | +COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/ |
| 18 | + |
| 19 | +# Install system dependencies and build tools |
| 20 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 21 | + ca-certificates \ |
| 22 | + git \ |
| 23 | + mc \ |
| 24 | + build-essential \ |
| 25 | + && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 26 | + |
| 27 | +# Set up app directory and user |
| 28 | +WORKDIR /app |
| 29 | + |
| 30 | +# Create a virtual environment and install dependencies with uv |
| 31 | +RUN git clone https://github.com/RosettaCommons/foundry /app/foundry \ |
| 32 | + && cd /app/foundry \ |
| 33 | + && uv venv --python 3.12 \ |
| 34 | + && uv pip install ".[all]" \ |
| 35 | + && /app/foundry/.venv/bin/foundry --help \ |
| 36 | + && /app/foundry/.venv/bin/foundry install base-models --checkpoint-dir /app/foundry/checkpoints \ |
| 37 | + && uv cache clean \ |
| 38 | + && chmod -R a+rX /root \ |
| 39 | + && chmod -R a+rX /app \ |
| 40 | + && echo |
| 41 | + |
| 42 | +#FINAL ------------------------------------------------------------------- |
| 43 | +FROM ${BASE_IMAGE} |
| 44 | + |
| 45 | +COPY --from=BUILDER /root /root |
| 46 | +COPY --from=BUILDER /app /app |
| 47 | +RUN chmod -R a+rX /root && chmod -R a+rX /app |
| 48 | + |
| 49 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 50 | + ca-certificates \ |
| 51 | + mc \ |
| 52 | + build-essential \ |
| 53 | + && apt-get clean \ |
| 54 | + && rm -rf /var/lib/apt/lists/* |
| 55 | + |
| 56 | +# Activate the venv at container start |
| 57 | +ENV PATH="/app/foundry/.venv/bin:$PATH" |
| 58 | +WORKDIR /app/foundry |
| 59 | + |
| 60 | +# Use bash as default shell |
| 61 | +SHELL ["/bin/bash", "-c"] |
| 62 | + |
| 63 | +# Do not set a default command to run foundry since each models uses a different command |
| 64 | +CMD ["bash"] |
| 65 | + |
0 commit comments