98 lines
2.7 KiB
YAML
98 lines
2.7 KiB
YAML
name: wearlab
|
|
|
|
services:
|
|
|
|
# ── Frontend: Vite dev server con Hot Module Replacement ─────────────────────
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
target: dev
|
|
volumes:
|
|
- ./frontend:/app
|
|
- frontend_node_modules:/app/node_modules
|
|
ports:
|
|
- "5173:5173"
|
|
networks:
|
|
- app
|
|
|
|
# ── Backend: PHP 8.4-FPM (Symfony) ───────────────────────────────────────────
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
target: dev
|
|
volumes:
|
|
- ./backend:/app
|
|
- backend_vendor:/app/vendor
|
|
- backend_var:/app/var
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app
|
|
|
|
# ── Nginx: reverse proxy ──────────────────────────────────────────────────────
|
|
nginx:
|
|
image: nginx:1.27-alpine
|
|
ports:
|
|
- "8080:80"
|
|
volumes:
|
|
- ./docker/nginx/nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
networks:
|
|
- app
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost/api/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# ── PostgreSQL 16 ─────────────────────────────────────────────────────────────
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- app
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
# ── Redis 7 ───────────────────────────────────────────────────────────────────
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "6379:6379"
|
|
networks:
|
|
- app
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
networks:
|
|
app:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
frontend_node_modules:
|
|
backend_vendor:
|
|
backend_var:
|