Switch Docker dependency installs to uv.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -1,7 +1,10 @@
|
||||
FROM python:3.14-slim
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
ARG APT_MIRROR=
|
||||
ARG PIP_INDEX_URL=
|
||||
@@ -19,16 +22,18 @@ RUN if [ -n "$APT_MIRROR" ]; then \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
# Optional PyPI mirror (pip reads these env vars)
|
||||
# Optional PyPI mirror (PIP_* kept for .env compat; mapped to uv only when set)
|
||||
ENV PIP_INDEX_URL=${PIP_INDEX_URL}
|
||||
ENV PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies (BuildKit pip cache survives rebuilds)
|
||||
# Install dependencies (BuildKit uv cache survives rebuilds)
|
||||
COPY requirements.txt .
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -r requirements.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
if [ -n "$PIP_INDEX_URL" ]; then export UV_DEFAULT_INDEX="$PIP_INDEX_URL"; fi; \
|
||||
if [ -n "$PIP_TRUSTED_HOST" ]; then export UV_INSECURE_HOST="$PIP_TRUSTED_HOST"; fi; \
|
||||
uv pip install --system -r requirements.txt
|
||||
|
||||
# Copy project
|
||||
COPY . .
|
||||
|
||||
Reference in New Issue
Block a user