FROM python:3.12-slim

# curl only so the container can answer its own healthcheck.
RUN apt-get update \
 && apt-get install -y --no-install-recommends curl \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY src/ ./src/

ENV PYTHONPATH=/app/src \
    PYTHONUNBUFFERED=1

# Nothing is written to disk. The queue lives in memory on purpose: if
# Control loses power, the parent calls must die with it.
RUN useradd --system --no-create-home coordinator
USER coordinator

CMD ["python", "-m", "parent_call.main"]
