# Build from the repository root so the shared package is in context:
#   docker build -f services/source/Dockerfile -t as0558844/source .
FROM python:3.12-slim

WORKDIR /app

# shared first (the traceability spine), then the service itself
COPY shared /app/shared
RUN pip install --no-cache-dir /app/shared

COPY services/source /app/services/source
RUN pip install --no-cache-dir /app/services/source

# BR-002: the raw upload is archived before the staging table is replaced.
# Local disk by default so the demo runs without MinIO (ARTIFACT_BACKEND=minio switches).
RUN mkdir -p /app/artifacts

ENV SERVICE_NAME=source \
    ARTIFACT_DIR=/app/artifacts \
    PYTHONUNBUFFERED=1

EXPOSE 8002

CMD ["uvicorn", "source.main:app", "--host", "0.0.0.0", "--port", "8002"]
