66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
services:
|
|
# MySQL Database
|
|
db:
|
|
image: mysql:8.0
|
|
container_name: wmms-db
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: wmms1234
|
|
MYSQL_DATABASE: wmms
|
|
ports:
|
|
- "3307:3306"
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
command: >
|
|
--default-authentication-plugin=mysql_native_password
|
|
--character-set-server=utf8mb4
|
|
--collation-server=utf8mb4_unicode_ci
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pwmms1234"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Backend API (Go)
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: wmms-backend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8082:8082"
|
|
environment:
|
|
DB_DSN: "root:wmms1234@tcp(db:3306)/wmms?charset=utf8mb4&parseTime=true"
|
|
GIN_MODE: release
|
|
volumes:
|
|
- uploads_data:/app/uploads
|
|
- ./scripts/migrations:/docker-entrypoint-initdb.d/migrations:ro
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
entrypoint: ["/app/entrypoint.sh"]
|
|
command: ["/app/server"]
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8082/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Frontend (Nginx)
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: wmms-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
mysql_data:
|
|
uploads_data:
|