92 lines
2.6 KiB
YAML
92 lines
2.6 KiB
YAML
# 服务器只运行本机已加载的镜像,禁止在服务器执行 docker compose build。
|
|
services:
|
|
db:
|
|
image: mariadb:11.4
|
|
pull_policy: missing
|
|
container_name: caiwu_db
|
|
restart: unless-stopped
|
|
env_file:
|
|
- ./runtime/.env
|
|
volumes:
|
|
- caiwu_database:/var/lib/mysql
|
|
healthcheck:
|
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 30s
|
|
|
|
# 团队共享 MariaDB 实例:逻辑上分为系统配置库和业务镜像库。
|
|
# 两个库独立备份、独立表结构,但复用同一套 TLS 入口和团队密码,
|
|
# 避免新人再填写第二套连接资料。正式业务库 caiwu_db 继续保持内网隔离。
|
|
config_db:
|
|
image: mariadb:11.4
|
|
pull_policy: missing
|
|
container_name: caiwu_config_db
|
|
restart: unless-stopped
|
|
env_file:
|
|
- ./runtime/config-db.env
|
|
command:
|
|
- "--innodb-buffer-pool-size=512M"
|
|
- "--innodb-log-buffer-size=32M"
|
|
- "--max-connections=60"
|
|
- "--table-open-cache=600"
|
|
- "--performance-schema=OFF"
|
|
ports:
|
|
- "0.0.0.0:13306:3306"
|
|
volumes:
|
|
- caiwu_config_database:/var/lib/mysql
|
|
- ./config-db-init.sh:/docker-entrypoint-initdb.d/10-config-db-security.sh:ro
|
|
networks:
|
|
- default
|
|
- config_database
|
|
mem_limit: 1536m
|
|
cpus: "2.00"
|
|
healthcheck:
|
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 30s
|
|
|
|
app:
|
|
image: caiwu_akaunting:${IMAGE_TAG:?IMAGE_TAG is required}
|
|
pull_policy: never
|
|
container_name: caiwu_app
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
config_db:
|
|
condition: service_healthy
|
|
environment:
|
|
RUN_MIGRATIONS: ${RUN_MIGRATIONS:-0}
|
|
env_file:
|
|
- ./runtime/qiniu-storage.env
|
|
ports:
|
|
- "127.0.0.1:18088:18088"
|
|
volumes:
|
|
- ./runtime/.env:/var/www/html/.env
|
|
- ./runtime/bills.sqlite:/var/www/html/runtime/bills.sqlite:ro
|
|
- caiwu_storage:/var/www/html/storage
|
|
healthcheck:
|
|
test:
|
|
- "CMD-SHELL"
|
|
- "runuser -u www-data -- php artisan app:ready --quiet && curl -fsS -o /dev/null http://127.0.0.1:18088/"
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 45s
|
|
|
|
volumes:
|
|
caiwu_database:
|
|
name: caiwu_database
|
|
caiwu_storage:
|
|
name: caiwu_storage
|
|
caiwu_config_database:
|
|
name: caiwu_config_database
|
|
|
|
networks:
|
|
config_database:
|
|
name: caiwu_config_database_network
|