fix: set PYTHONPATH=/app so alembic can import app package

When the alembic console-script entry point runs, Python sets sys.path[0]
to the entry point directory (/usr/local/bin/), not the WORKDIR. Without
PYTHONPATH=/app, `from app.models import Base` in alembic/env.py fails
with ModuleNotFoundError. uvicorn is unaffected as it adds CWD to
sys.path itself.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 21:42:39 +01:00
parent 853f26d326
commit 3f5b0d1591

View File

@@ -1,6 +1,7 @@
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONPATH=/app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libpq-dev \