Skip to content

Commit

Permalink
Set UV_COMPILE_BYTECODE and UV_LINK_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Sep 4, 2024
1 parent 383dc38 commit 9c3a8f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
# Install the project into `/app`
WORKDIR /app

# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1

# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy

# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.multistage
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# First, build the application in the `/app` directory.
# See `Dockerfile` for details.
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
WORKDIR /app
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
Expand Down

0 comments on commit 9c3a8f7

Please sign in to comment.