Question Details

No question body available.

Tags

python docker uv

Answers (1)

January 6, 2026 Score: 1 Rep: 41 Quality: Low Completeness: 50%

Use uv sync to install into a standard virtual environment (.venv) and make sure your Python interpreter exists in the exact same path in the builder and final stages.

The easiest way is to run uv inside an image identical to your final target. Something like this would work:

FROM gcc:15-trixie AS builder

RUN apt-get update && apt-get install -y python3 python3-venv

COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app

COPY . .

RUN uv sync --frozen --no-dev

FROM gcc:15-trixie

RUN apt-get update && apt-get install -y python3

COPY --from=builder /app/.venv /app/.venv

ENV PATH="/app/.venv/bin:$PATH"

CMD ["sandworm"]