|
1 | 1 | #syntax=docker/dockerfile:1.4
|
2 | 2 |
|
3 |
| -ARG TAG=2024-11-21a-empty |
| 3 | +ARG TAG=main-small |
| 4 | +ARG UV_VERSION="0.5.4" |
4 | 5 |
|
5 |
| -FROM ghcr.io/astral-sh/uv:0.5.4 as uv |
| 6 | +FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv |
| 7 | +FROM ghcr.io/astral-sh/uv:${UV_VERSION}-bookworm-slim AS diffusers-build-env |
| 8 | +ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_INSTALL_DIR=/workspace/helix/runner/helix-diffusers/.python |
| 9 | +WORKDIR /workspace/helix/runner/helix-diffusers |
| 10 | +RUN --mount=type=cache,target=/root/.cache/uv \ |
| 11 | + --mount=type=bind,source=runner/helix-diffusers/.python-version,target=.python-version \ |
| 12 | + --mount=type=bind,source=runner/helix-diffusers/uv.lock,target=uv.lock \ |
| 13 | + --mount=type=bind,source=runner/helix-diffusers/pyproject.toml,target=pyproject.toml \ |
| 14 | + uv sync --frozen --no-install-project --no-dev |
| 15 | +ADD runner/helix-diffusers /workspace/helix/runner/helix-diffusers |
| 16 | +RUN --mount=type=cache,target=/root/.cache/uv \ |
| 17 | + uv sync --frozen --no-dev |
6 | 18 |
|
7 | 19 | ### BUILD
|
8 | 20 |
|
@@ -47,14 +59,10 @@ WORKDIR /workspace/helix
|
47 | 59 | # Copy runner directory from the repo
|
48 | 60 | COPY runner ./runner
|
49 | 61 |
|
50 |
| -# We need to set this environment variable so that uv knows where |
51 |
| -# the virtual environment is to install packages |
52 |
| -ENV UV_PROJECT_ENVIRONMENT=/workspace/helix/runner/helix-diffusers/venv |
53 |
| - |
54 |
| -# Install the packages with uv using --mount=type=cache to cache the downloaded packages |
55 |
| -RUN --mount=type=cache,target=/root/.cache/uv \ |
56 |
| - --mount=from=uv,source=/uv,target=/usr/bin/uv \ |
57 |
| - cd /workspace/helix/runner/helix-diffusers && uv sync --no-dev |
| 62 | +# Copy the diffusers build environment including Python |
| 63 | +COPY --from=ghcr.io/astral-sh/uv:0.5.4 /uv /bin/uv |
| 64 | +COPY --from=diffusers-build-env /workspace/helix/runner/helix-diffusers /workspace/helix/runner/helix-diffusers |
| 65 | +ENV PATH="/workspace/helix/runner/helix-diffusers/.venv/bin:$PATH" |
58 | 66 |
|
59 | 67 | # Copy the cog wrapper, cog and cog-sdxl is installed in the base image, this is just the cog server
|
60 | 68 | COPY cog/helix_cog_wrapper.py /workspace/cog-sdxl/helix_cog_wrapper.py
|
|
0 commit comments