# Backend — image minimaliste (image minimale, non-root)
FROM python:3.12-slim

# Utilisateur non privilégié transforme une échappée en élévation directe sur l'hôte).
RUN useradd --create-home --uid 10001 appuser
WORKDIR /app

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

COPY app.py store_file.py store_firestore.py config.py ./

# config.py est injecté au runtime (jamais dans l'image — module 07).
RUN mkdir -p /app/data && chown appuser:appuser /app /app/data
USER appuser

EXPOSE 5000
CMD ["python", "app.py"]
