FROM python:3.12.16-slim-trixie@sha256:5b5fe805d367f8f5a359ded6ab2652b7f9a206453ee6ee789c0045ba6ec15016
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_DEFAULT_TIMEOUT=60 PIP_RETRIES=3
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && pip uninstall --yes pip && groupadd --gid 10001 app && useradd --uid 10001 --gid app --no-create-home --shell /usr/sbin/nologin app
COPY --chown=app:app server.py ./server.py
COPY --chown=app:app jobs.py ./jobs.py
COPY --chown=app:app telemetry.py ./telemetry.py
COPY --chown=app:app security_runtime.py bao_client.py supervise.py ./
COPY --chown=app:app migrations ./migrations
COPY --chown=app:app scripts/reprocess_pipeline.py ./scripts/reprocess_pipeline.py
COPY --chown=app:app scripts/replay_failed.py ./scripts/replay_failed.py
COPY --chown=app:app scripts/cleanup_staging.py ./scripts/cleanup_staging.py
COPY --chown=app:app tests/fixtures/sample.png ./tests/fixtures/sample.png
USER 10001:10001
EXPOSE 8080
CMD ["python", "server.py"]
