docker update

This commit is contained in:
2025-10-16 21:31:32 +05:30
parent 6fc27d0897
commit 97de061e60
2 changed files with 75 additions and 27 deletions

View File

@ -14,14 +14,19 @@ services:
- "3307:3306"
volumes:
- mysql_data:/var/lib/mysql
networks:
- vending-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpass"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
backend:
build:
context: ./Machine-Backend
dockerfile: Dockerfile
container_name: vending-backend
env_file:
- ./Machine-Backend/.env
@ -29,12 +34,20 @@ services:
- "8087:5000"
volumes:
- ./Machine-Backend:/app
networks:
- vending-network
depends_on:
db:
condition: service_healthy
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
command: >
sh -c "python seed_user.py && gunicorn --bind 0.0.0.0:5000 run:app"
sh -c "python seed_user.py && gunicorn --bind 0.0.0.0:5000 --workers 2 --timeout 120 run:app"
frontend:
build:
@ -43,9 +56,23 @@ services:
container_name: vending-frontend
ports:
- "8086:80"
networks:
- vending-network
depends_on:
- backend
backend:
condition: service_healthy
restart: always
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
vending-network:
driver: bridge
volumes:
mysql_data:
mysql_data:
driver: local