# syntax=docker/dockerfile:1.7
# Lesson 02: multi-stage build for the expiry worker.

# --- Stage 1: builder ---
FROM python:3.11-slim AS builder
WORKDIR /build
COPY requirements.txt .
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install --no-cache-dir --prefix=/install -r requirements.txt

# --- Stage 2: runtime ---
FROM python:3.11-slim
COPY --from=builder /install /usr/local
RUN useradd --create-home --uid 1000 app
WORKDIR /app
COPY --chown=app:app worker.py .
USER app
CMD ["python", "worker.py"]
