Switch Docker dependency installs to uv.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-09 18:33:31 +03:30
parent 2753a6e7dc
commit 526e4daa15
3 changed files with 11 additions and 6 deletions

View File

@@ -4,6 +4,6 @@ HTTP_PORT=80
# Optional Debian apt mirror host (replaces deb.debian.org / security.debian.org) # Optional Debian apt mirror host (replaces deb.debian.org / security.debian.org)
# APT_MIRROR=mirrors.tuna.tsinghua.edu.cn # APT_MIRROR=mirrors.tuna.tsinghua.edu.cn
# Optional PyPI index URL for pip during image build # Optional PyPI index URL for uv during image build
# PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple # PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
# PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn # PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn

View File

@@ -1,7 +1,10 @@
FROM python:3.14-slim FROM python:3.14-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV UV_LINK_MODE=copy
ARG APT_MIRROR= ARG APT_MIRROR=
ARG PIP_INDEX_URL= ARG PIP_INDEX_URL=
@@ -19,16 +22,18 @@ RUN if [ -n "$APT_MIRROR" ]; then \
fi; \ fi; \
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_INDEX_URL=${PIP_INDEX_URL}
ENV PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST} ENV PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}
WORKDIR /app WORKDIR /app
# Install dependencies (BuildKit pip cache survives rebuilds) # Install dependencies (BuildKit uv cache survives rebuilds)
COPY requirements.txt . COPY requirements.txt .
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/uv \
pip install -r requirements.txt 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 project
COPY . . COPY . .

View File

@@ -29,7 +29,7 @@ The application is fully containerized using Docker, meaning it can be deployed
``` ```
- `HTTP_PORT` — host port for the app (default `80`) - `HTTP_PORT` — host port for the app (default `80`)
- `APT_MIRROR` — Debian apt mirror host used during image build - `APT_MIRROR` — Debian apt mirror host used during image build
- `PIP_INDEX_URL` / `PIP_TRUSTED_HOST` — PyPI mirror used by pip during image build - `PIP_INDEX_URL` / `PIP_TRUSTED_HOST` — PyPI mirror used by uv during image build (`PIP_TRUSTED_HOST` allows insecure/HTTP hosts)
3. Start the application stack using Docker Compose: 3. Start the application stack using Docker Compose:
```bash ```bash
docker compose up -d --build docker compose up -d --build