Root cause: Dockerfile build context is ./app/ but VERSION file is at repo root, so it's excluded from the Docker image. The context processor tried parent.parent.parent which resolves to / inside the container. Fix: - Context processor now checks APP_VERSION env var first, then tries multiple file paths (repo root for local dev, app/ dir for Docker) - Dockerfile accepts APP_VERSION build arg and sets it as ENV - compose.yml passes APP_VERSION build arg to all service builds Note: Deploy script needs `export APP_VERSION=$(cat VERSION)` before docker-compose build for the build arg to pick up the version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
594 B
Docker
20 lines
594 B
Docker
FROM python:3.12-slim
|
|
ARG APP_VERSION=unknown
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
APP_VERSION=$APP_VERSION
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential libpq-dev postgresql-client \
|
|
libpango-1.0-0 libpangoft2-1.0-0 libcairo2 libffi-dev \
|
|
libgdk-pixbuf-xlib-2.0-0 libharfbuzz0b libfribidi0 \
|
|
libjpeg-dev libpng-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt /app/
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
COPY . /app
|
|
|
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|