87 lines
2.5 KiB
YAML
87 lines
2.5 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
# ============================================================
|
||
# MySQL Database
|
||
# ============================================================
|
||
db:
|
||
image: mysql:8.0
|
||
container_name: santinova-facturation-db
|
||
restart: unless-stopped
|
||
environment:
|
||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-santinova_db_pass}
|
||
MYSQL_DATABASE: facturation_santinova
|
||
MYSQL_CHARACTER_SET_SERVER: utf8mb4
|
||
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
|
||
volumes:
|
||
- mysql_data:/var/lib/mysql
|
||
networks:
|
||
- web
|
||
healthcheck:
|
||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_ROOT_PASSWORD:-santinova_db_pass}"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
start_period: 30s
|
||
|
||
# ============================================================
|
||
# Application (Backend + Frontend)
|
||
# ============================================================
|
||
app:
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile
|
||
container_name: santinova-facturation-app
|
||
restart: unless-stopped
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
environment:
|
||
NODE_ENV: production
|
||
PORT: 3001
|
||
# Le réseau web est partagé par plusieurs projets : ne jamais utiliser l’alias générique `db`.
|
||
DATABASE_URL: mysql://root:${DB_ROOT_PASSWORD:-santinova_db_pass}@santinova-facturation-db:3306/facturation_santinova
|
||
JWT_SECRET: ${JWT_SECRET:-santinova-jwt-secret-change-in-production}
|
||
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-24h}
|
||
UPLOAD_DIR: /app/uploads
|
||
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
|
||
ports:
|
||
- "${APP_PORT:-8080}:3001"
|
||
volumes:
|
||
- uploads_data:/app/uploads
|
||
networks:
|
||
- web
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 15s
|
||
|
||
# ============================================================
|
||
# Database Migration & Seed (run once)
|
||
# ============================================================
|
||
migrate:
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile.migrate
|
||
container_name: santinova-facturation-migrate
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
environment:
|
||
DATABASE_URL: mysql://root:${DB_ROOT_PASSWORD:-santinova_db_pass}@santinova-facturation-db:3306/facturation_santinova
|
||
networks:
|
||
- web
|
||
restart: "no"
|
||
|
||
volumes:
|
||
mysql_data:
|
||
driver: local
|
||
uploads_data:
|
||
driver: local
|
||
|
||
networks:
|
||
web:
|
||
external: true
|