Update docker-compose healthcheck and restart policies

Replaces the db service healthcheck command with a custom script and adjusts its parameters for longer timeouts and retries. Also changes the app service's depends_on syntax and adds a restart policy to improve container reliability.
这个提交包含在:
Peter Goodhall 2025-07-17 17:18:56 +01:00
父节点 bd1a92d660
当前提交 6938580513

查看文件

@ -14,10 +14,10 @@ services:
- ./:/var/www/html:rw
command: ["./script.sh"]
depends_on:
db:
condition: service_healthy
- db
networks:
- mynet
restart: on-failure
db:
build:
@ -30,11 +30,11 @@ services:
networks:
- mynet
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
interval: 10s
start_period: 30s
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
timeout: 30s
retries: 20
interval: 15s
start_period: 60s
volumes:
db_data: {}