# Pinned by digest, not just tag, so a build is reproducible and can't
# silently pick up a swapped/tampered image under the same tag. Refresh
# by checking https://hub.docker.com/_/python/tags?name=3.11-slim for
# the current digest of this tag.
FROM python:3.11-slim@sha256:db3ff2e1800a8581e2c48a27c3995339d47bdf046da21c7627accd3d51053a93

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Don't run the app as root — a container-escape or RCE bug is far
# less useful to an attacker without root inside the container too.
RUN useradd --create-home --shell /usr/sbin/nologin appuser \
    && chown -R appuser:appuser /app
USER appuser

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]