fixing docker compose

This commit is contained in:
2025-09-08 15:36:17 +02:00
parent 008eb7906b
commit a369972119
2 changed files with 20 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ ENV FLASK_SECRET=production-secret-change-me
RUN apt-get update && apt-get install -y \
gcc \
default-libmysqlclient-dev \
default-mysql-client \
pkg-config \
curl \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -7,12 +7,25 @@ echo "🚀 Starting Jobs App container..."
# Wait for MySQL to be ready
echo "⏳ Waiting for MySQL to be ready..."
while ! mysqladmin ping -h mysql -u jobs -pjobdb --silent; do
echo "MySQL is not ready, waiting..."
sleep 2
done
echo "✅ MySQL is ready!"
python -c "
import time
import pymysql
while True:
try:
conn = pymysql.connect(
host='mysql',
user='jobs',
password='jobdb',
database='jobs',
connect_timeout=5
)
conn.close()
print('✅ MySQL is ready!')
break
except pymysql.Error as e:
print(f'MySQL is not ready: {e}, waiting...')
time.sleep(2)
"
# Run database setup
echo "🗄️ Setting up database..."