Add waitress + caddy deployment
This commit is contained in:
31
docker-entrypoint.sh
Normal file
31
docker-entrypoint.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Copy static files to shared volume if they don't exist
|
||||
# This allows Caddy to serve static files directly
|
||||
if [ ! -f /shared/static/.static-files-ready ]; then
|
||||
echo "Copying static files to shared volume..."
|
||||
cp -r /app/src/hxbooks/static/* /shared/static/
|
||||
touch /shared/static/.static-files-ready
|
||||
echo "Static files copied successfully"
|
||||
else
|
||||
echo "Static files already present in shared volume"
|
||||
fi
|
||||
|
||||
# Initialize database if it doesn't exist or run migrations if it does
|
||||
echo "Checking database status..."
|
||||
if [ ! -f /app/instance/hxbooks.sqlite ]; then
|
||||
echo "Database not found. Initializing database..."
|
||||
hxbooks db init
|
||||
echo "Database initialized successfully"
|
||||
else
|
||||
echo "Database exists. Running migrations..."
|
||||
# Run Flask-Migrate migrations
|
||||
flask db upgrade 2>/dev/null || {
|
||||
echo "No migrations to run or migration failed. Database ready."
|
||||
}
|
||||
fi
|
||||
|
||||
# Start the application
|
||||
echo "Starting HXBooks application..."
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user