89 lines
2.3 KiB
YAML
89 lines
2.3 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
|
|
|
|
# 独立的财务系统配置数据库。只开放这个容器,正式业务库 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=64M"
|
|
- "--innodb-log-buffer-size=8M"
|
|
- "--max-connections=30"
|
|
- "--table-open-cache=200"
|
|
- "--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: 256m
|
|
cpus: "0.50"
|
|
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
|
|
- 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
|