chore: add container healthchecks and dependency conditions to docker-compose services
This commit is contained in:
@@ -7,10 +7,14 @@ services:
|
|||||||
image: truncgil-finance-app:latest
|
image: truncgil-finance-app:latest
|
||||||
container_name: truncgil-finance-app
|
container_name: truncgil-finance-app
|
||||||
restart: always
|
restart: always
|
||||||
|
stop_grace_period: 1m
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www
|
- .:/var/www
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
web:
|
web:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
@@ -23,11 +27,14 @@ services:
|
|||||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
container_name: truncgil-finance-db
|
container_name: truncgil-finance-db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
stop_grace_period: 2m
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: root
|
MYSQL_ROOT_PASSWORD: root
|
||||||
MYSQL_DATABASE: truncgil_finance
|
MYSQL_DATABASE: truncgil_finance
|
||||||
@@ -39,6 +46,12 @@ services:
|
|||||||
- app-network
|
- app-network
|
||||||
ports:
|
ports:
|
||||||
- "3308:3306"
|
- "3308:3306"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -proot"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
|
|||||||
Reference in New Issue
Block a user