- Dockerfile backend (Python 3.11 + Poetry + Playwright/Chromium) - Dockerfile frontend (Node 20 + Vite build + Nginx) - docker-compose.yml avec services et volumes persistants - Proxy Nginx pour API (/api -> backend:8008) - Healthchecks sur les deux services - Configuration Docker (.env.docker, .dockerignore) - Documentation déploiement Docker dans README - Fichier docs/tools_used.md avec liste des technologies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
71 lines
1.7 KiB
Docker
71 lines
1.7 KiB
Docker
# Dockerfile Backend - FastAPI + Playwright
|
|
FROM python:3.11-slim
|
|
|
|
# Métadonnées
|
|
LABEL maintainer="gilles" \
|
|
description="Backend suivi_produit - FastAPI + Playwright scraper"
|
|
|
|
# Variables d'environnement
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
POETRY_VERSION=1.7.1 \
|
|
POETRY_HOME="/opt/poetry" \
|
|
POETRY_VIRTUALENVS_CREATE=false \
|
|
POETRY_NO_INTERACTION=1
|
|
|
|
# Dépendances système pour Playwright
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
# Dépendances Playwright/Chromium
|
|
libnss3 \
|
|
libnspr4 \
|
|
libatk1.0-0 \
|
|
libatk-bridge2.0-0 \
|
|
libcups2 \
|
|
libdrm2 \
|
|
libdbus-1-3 \
|
|
libxkbcommon0 \
|
|
libatspi2.0-0 \
|
|
libxcomposite1 \
|
|
libxdamage1 \
|
|
libxfixes3 \
|
|
libxrandr2 \
|
|
libgbm1 \
|
|
libasound2 \
|
|
libpango-1.0-0 \
|
|
libcairo2 \
|
|
fonts-liberation \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Installer Poetry
|
|
RUN curl -sSL https://install.python-poetry.org | python3 - \
|
|
&& ln -s /opt/poetry/bin/poetry /usr/local/bin/poetry
|
|
|
|
WORKDIR /app
|
|
|
|
# Copier les fichiers de dépendances
|
|
COPY pyproject.toml poetry.lock* ./
|
|
|
|
# Installer les dépendances Python
|
|
RUN poetry install --only main --no-root
|
|
|
|
# Installer Playwright et le navigateur Chromium
|
|
RUN playwright install chromium \
|
|
&& playwright install-deps chromium
|
|
|
|
# Copier le code source
|
|
COPY backend/ ./backend/
|
|
|
|
# Créer les répertoires de données
|
|
RUN mkdir -p backend/data backend/logs backend/data/raw
|
|
|
|
# Exposer le port
|
|
EXPOSE 8008
|
|
|
|
# Healthcheck
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8008/health || exit 1
|
|
|
|
# Commande de démarrage
|
|
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8008"]
|