Switch Docker dependency installs to uv #30
@@ -4,6 +4,6 @@ HTTP_PORT=80
|
||||
# Optional Debian apt mirror host (replaces deb.debian.org / security.debian.org)
|
||||
# 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_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
|
||||
|
||||
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 . .
|
||||
|
||||
@@ -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`)
|
||||
- `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:
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
|
||||
Reference in New Issue
Block a user