FROM python:3.11-slim

WORKDIR /app

# Private index for the internal Aetos libraries — pass credentials as build args.
ARG PIP_REGISTRY_USERNAME
ARG PIP_REGISTRY_PASSWORD
ENV PIP_EXTRA_INDEX_URL=https://${PIP_REGISTRY_USERNAME}:${PIP_REGISTRY_PASSWORD}@pip.aetoskia.com/simple

COPY pyproject.toml ./
COPY . .
RUN pip install --no-cache-dir --upgrade pip \
 && pip install --no-cache-dir --extra-index-url "${PIP_EXTRA_INDEX_URL}" .

EXPOSE 8000

# Two processes, per the two axes:
#   - main.py   : the spec-first FastAPI application
#   - worker.py : the pipeline consumer polling pending jobs
CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port 8000 & exec python worker.py"]