Fixing issues with env
All checks were successful
Build and Publish Docker Image / build (push) Successful in 3m33s
All checks were successful
Build and Publish Docker Image / build (push) Successful in 3m33s
This commit is contained in:
parent
90fd42782a
commit
88d4fc909a
3 changed files with 36 additions and 8 deletions
|
@ -1,5 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Function to check required environment variables
|
||||
check_required_vars() {
|
||||
local missing_vars=0
|
||||
for var in "$@"; do
|
||||
if [ -z "${!var}" ]; then
|
||||
echo "Error: Required environment variable $var is not set"
|
||||
missing_vars=1
|
||||
fi
|
||||
done
|
||||
if [ $missing_vars -eq 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check required environment variables (add your required variables here)
|
||||
check_required_vars "FLASK_APP" "FLASK_ENV" "STORAGE_URL"
|
||||
|
||||
# Wait for database to be ready (if using PostgreSQL)
|
||||
# until PGPASSWORD=$DATABASE_PASSWORD psql -h "$DATABASE_HOST" -U "$DATABASE_USER" -d "$DATABASE_NAME" -c '\q'; do
|
||||
# echo "Waiting for database..."
|
||||
|
@ -9,5 +26,9 @@
|
|||
# Apply database migrations
|
||||
flask db upgrade
|
||||
|
||||
# Start gunicorn
|
||||
exec gunicorn --bind 0.0.0.0:5000 app:app
|
||||
# Start gunicorn with proper environment handling
|
||||
exec gunicorn --bind 0.0.0.0:5000 \
|
||||
--env FLASK_APP=${FLASK_APP} \
|
||||
--env FLASK_ENV=${FLASK_ENV} \
|
||||
--env STORAGE_URL=${STORAGE_URL} \
|
||||
app:app
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue