From 9c3a8f7be07b0b98d96f2421e8469e1024d61f5b Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 4 Sep 2024 11:43:42 -0500 Subject: [PATCH] Set `UV_COMPILE_BYTECODE` and `UV_LINK_MODE` --- Dockerfile | 6 ++++++ Dockerfile.multistage | 1 + 2 files changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6c4a00e..690f127 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ diff --git a/Dockerfile.multistage b/Dockerfile.multistage index e6d31b3..f054eb4 100644 --- a/Dockerfile.multistage +++ b/Dockerfile.multistage @@ -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 \