Files
jobs/docker-entrypoint.sh
georg.sinn-schirwitz 5940e1f8b4 Docker functionality
2025-09-08 14:51:04 +02:00

36 lines
790 B
Bash

#!/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 "$@"