Files
sejeteralo/docker/backend.Dockerfile
Yvv 8341a050d3
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
fix prod : Eau2018.xls dans l'image Docker + build context racine
- backend.Dockerfile : COPY Eau2018.xls /app/ (contexte = racine projet)
- docker-compose.yml : section build: pour backend et frontend (context: ..)
- seed.py : XLS_PATH cherche d'abord /app/Eau2018.xls, fallback ../

Sans ça python seed.py échoue dans le conteneur (fichier absent)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:15:06 +01:00

40 lines
1.0 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 /app/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
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"]