cangku/deploy/production/docker-compose.yml
2026-09-12 16:55:48 +08:00

80 lines
2.2 KiB
YAML

name: cangku
services:
mysql:
image: mysql:8.0.39
container_name: cangku-mysql
restart: unless-stopped
env_file:
- /opt/cangku/shared/mysql.env
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
ports:
- 127.0.0.1:3307:3306
volumes:
- /opt/cangku/data/mysql:/var/lib/mysql
- ../../backend/database/init.sql:/docker-entrypoint-initdb.d/001-init.sql:ro
- ../../backend/database/summary_tables.sql:/docker-entrypoint-initdb.d/002-summary-tables.sql:ro
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -p$$MYSQL_ROOT_PASSWORD --silent"]
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
networks:
- cangku-internal
backend:
build:
context: ../../backend
dockerfile: Dockerfile.production
container_name: cangku-backend
restart: unless-stopped
env_file:
- /opt/cangku/shared/backend.env
ports:
- 127.0.0.1:4090:4090
volumes:
- /opt/cangku/data/backend:/app/runtime
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "const s=require('node:net').connect(4090,'127.0.0.1',()=>{s.end();process.exit(0)});s.setTimeout(3000,()=>process.exit(1));s.on('error',()=>process.exit(1))"]
interval: 10s
timeout: 5s
retries: 18
start_period: 30s
networks:
- cangku-internal
bootstrap:
build:
context: ../../remote-access/server
dockerfile: Dockerfile.production
container_name: cangku-bootstrap
restart: unless-stopped
env_file:
- /opt/cangku/shared/bootstrap.env
ports:
- 127.0.0.1:4092:4092
volumes:
- /opt/cangku/data/bootstrap:/var/lib/cangku-bootstrap
- /etc/ssh/ssh_host_ed25519_key.pub:/etc/ssh/ssh_host_ed25519_key.pub:ro
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:4092/health', timeout=3)"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
networks:
- cangku-internal
networks:
cangku-internal:
name: cangku-internal