88 lines
2.5 KiB
YAML
88 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
|
|
ports:
|
|
- "${DB_PORT:-3306}:3306"
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
networks:
|
|
- santinova-network
|
|
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
|
|
DATABASE_URL: mysql://root:${DB_ROOT_PASSWORD:-santinova_db_pass}@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:
|
|
- santinova-network
|
|
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}@db:3306/facturation_santinova
|
|
networks:
|
|
- santinova-network
|
|
restart: "no"
|
|
|
|
volumes:
|
|
mysql_data:
|
|
driver: local
|
|
uploads_data:
|
|
driver: local
|
|
|
|
networks:
|
|
santinova-network:
|
|
driver: bridge
|