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:
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user