59 lines
2.1 KiB
YAML
59 lines
2.1 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 — persistant entre les redémarrages
|
|
- 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 pour éviter re-téléchargement
|
|
- yolo_models:/root/.config/Ultralytics
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"]
|
|
interval: |