Docker functionality

This commit is contained in:
georg.sinn-schirwitz
2025-09-08 14:51:04 +02:00
parent 042a196718
commit 5940e1f8b4
7 changed files with 440 additions and 0 deletions

35
docker-entrypoint.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Docker entrypoint script for Jobs App
set -e
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!"
# Run database setup
echo "🗄️ Setting up database..."
python setup.py mysql-init
# Seed initial data if needed
echo "🌱 Seeding initial data..."
python -c "
from web.db import db_init
from web.utils import initialize_users_from_settings
db_init()
try:
initialize_users_from_settings()
print('✅ Users seeded successfully')
except Exception as e:
print(f'⚠️ User seeding failed: {e}')
"
echo "🎯 Starting Gunicorn server..."
exec "$@"