FROM python:3.12-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    SERVICE_NAME=seed

WORKDIR /app

# The shared traceability spine first, then the seeder itself.
COPY shared /app/shared
RUN pip install --no-cache-dir /app/shared

COPY seed /app/seed
RUN pip install --no-cache-dir /app/seed

# The workbook's own figures travel with the image.
ENV SEED_DATA_DIR=/app/seed/data

# A one-shot Compose job: it waits for the gateway, seeds, prints and exits.
CMD ["python", "-m", "as0558844_seed", "--base-url", "http://gateway:8000", "--wait-for-health", "120"]
