Docker buid issue

This commit is contained in:
2025-10-17 11:04:16 +05:30
parent a3d3fa4435
commit 739b88e92c
3 changed files with 44 additions and 32 deletions

View File

@ -40,26 +40,12 @@ services:
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 "
echo '⏳ Waiting for MySQL to be ready for connections...'
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
if mysql -h db -u vendinguser -pvendingpass -e 'SELECT 1' >/dev/null 2>&1; then
echo '✓ MySQL is ready!'
break
fi
echo 'Waiting for MySQL... (attempt' $$i'/15)'
sleep 3
done
echo '🌱 Running database seed script...'
python seed_user.py
echo '🚀 Starting Gunicorn server...'
python wait_for_db.py &&
echo '🌱 Running database seed script...' &&
python seed_user.py &&
echo '🚀 Starting Gunicorn server...' &&
gunicorn --bind 0.0.0.0:5000 --workers 2 --timeout 120 run:app
"