1
0
forked from EHV/sejeteralo
Files
sejeteralo/docker/backend.Dockerfile
syoul b24f226b35 fix prod : Eau2018.xls hors du volume /app + pin Trivy
Le volume backend-data monté sur /app masquait Eau2018.xls copié dans
l'image à /app/Eau2018.xls — d'où le FileNotFoundError au step seed CI.

- Dockerfile : copie Eau2018.xls dans /opt/ (hors mount)
- seed.py : résolution multi-chemin avec /opt en priorité (Docker)
- .woodpecker.yml : trivy:latest -> trivy:0.70.0 (pin reproductibilité)

Note : si le seed replante avec la même erreur après ce commit, c'est
que le volume backend-data en prod a aussi un seed.py figé (shadowing
de /app entier). Fix de fond à venir : déplacer le mount sur /app/data.
2026-04-26 22:57:39 +02:00

41 lines
1.1 KiB
Docker

# syntax = docker/dockerfile:1
FROM python:3.11-slim AS base
WORKDIR /app
# Build (install dependencies)
FROM base AS build
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/ .
COPY Eau2018.xls /opt/Eau2018.xls
# Production
FROM base AS production
ENV PYTHONUNBUFFERED=1
COPY --from=build /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=build /usr/local/bin/uvicorn /usr/local/bin/uvicorn
COPY --from=build /usr/local/bin/alembic /usr/local/bin/alembic
COPY --from=build /app /app
COPY --from=build /opt/Eau2018.xls /opt/Eau2018.xls
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/docs')" || exit 1
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
# Development
FROM base AS development
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
WORKDIR /app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]