Skip to content

Commit d6e6b57

Browse files
vitoficoclaude
andcommitted
🐛 fix(server): Dockerfile uses venv + copies source before install
Two stacked issues: - python:3.12-slim marks system Python as externally-managed (PEP 668), so `uv pip install --system` fails. Switch to a project venv at /opt/venv and put it on PATH. - setuptools needs the opds_sync/ source tree at install time, but the original COPY ordering installed before copying. Reorder. Verified locally: image builds and `from opds_sync.main import create_app` works in the resulting container. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1effff1 commit d6e6b57

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

server/Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@ FROM python:3.12-slim AS base
22

33
ENV PYTHONUNBUFFERED=1 \
44
PYTHONDONTWRITEBYTECODE=1 \
5-
PIP_NO_CACHE_DIR=1
5+
PIP_NO_CACHE_DIR=1 \
6+
VIRTUAL_ENV=/opt/venv \
7+
PATH=/opt/venv/bin:$PATH
68

79
WORKDIR /app
810

911
RUN apt-get update && apt-get install -y --no-install-recommends \
1012
build-essential libpq-dev \
1113
&& rm -rf /var/lib/apt/lists/*
1214

13-
COPY pyproject.toml ./
14-
RUN pip install --no-cache-dir uv && \
15-
uv pip install --system "."
15+
# uv installs into a project venv (avoids PEP 668 on python:3.12-slim, which
16+
# marks the system Python as externally-managed).
17+
RUN pip install --no-cache-dir uv && uv venv "$VIRTUAL_ENV"
1618

19+
# Source needs to be present so setuptools can discover the package.
20+
COPY pyproject.toml ./
1721
COPY opds_sync ./opds_sync
22+
RUN uv pip install "."
23+
1824
COPY migrations ./migrations
1925
COPY alembic.ini ./
2026

0 commit comments

Comments
 (0)