Files
shoottracker/docker-compose.yml

65 lines
2.4 KiB
YAML

version: '3.8'
# ─── Développement local ──────────────────────────────────────────────────────
# Usage : docker-compose up --build
#
# Nécessite un fichier .env à la racine avec :
# JWT_SECRET=<clé secrète longue et aléatoire>
# CORS_ORIGIN=http://localhost:5173 (optionnel)
services:
# ─── App principale (frontend + backend) ────────────────────────────────────
shoottracker-app:
build:
context: .
dockerfile: Dockerfile
container_name: shoottracker-app
restart: unless-stopped
ports:
- "3001:3001"
environment:
NODE_ENV: production
PORT: 3001
JWT_SECRET: ${JWT_SECRET:-changeme_use_a_real_secret_in_production}
AI_SERVICE_URL: http://shoottracker-ai:8000
CORS_ORIGIN: ${CORS_ORIGIN:-*}
UPLOADS_DIR: /app/data/uploads
volumes:
# SQLite DB + uploads — bind mount sur l'hôte (survit aux redéploiements)
- /opt/shoottracker/data:/app/data
depends_on:
shoottracker-ai:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3001/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# ─── Microservice IA ─────────────────────────────────────────────────────────
shoottracker-ai:
build:
context: ./ai-service
dockerfile: Dockerfile
container_name: shoottracker-ai
restart: unless-stopped
# Pas de ports exposés sur l'hôte : accessible uniquement en interne
# (shoottracker-app -> http://shoottracker-ai:8000 via Docker network)
expose:
- "8000"
environment:
PORT: 8000
YOLO_MODEL_PATH: yolov8n.pt
volumes:
# Cache du modèle YOLOv8 — bind mount sur l'hôte (évite re-téléchargement à chaque redéploiement)
- /opt/shoottracker/yolo-models:/root/.config/Ultralytics
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"]
interval: 30s
timeout: 15s
retries: 3
start_period: 60s
# Pas de volumes nommés — bind mounts définis directement dans chaque service