pkmntrade.club/scripts/deploy.sh
badbl0cks d4948e7cd3
fix: Ensure deploy script runs once and is part of entrypoint
The deploy.sh script is now re-added to the entrypoint.sh script
to ensure it runs only during first container startup.

A flag file (/flags/.deployed) is now created after a successful deployment.
The deploy.sh script checks for this flag and will not re-run
deployment steps unless FORCE_DEPLOY is set to true. This prevents
unnecessary re-runs of migrations, collectstatic, etc., on subsequent
container starts within the same deployment.

Corrected permissions for `/app/.cursor-server` and created a `/flags`
directory with appropriate permissions in the `Dockerfile`. Added
ENV DJANGO_SETTINGS_MODULE with default value to `Dockerfile`.
2025-05-23 18:39:29 -07:00

23 lines
No EOL
611 B
Bash
Executable file

#!/bin/bash
if [[ -f /flags/.deployed && "$FORCE_DEPLOY" != "true" ]]; then
echo "*** Previously deployed successfully."
exit 0
fi
echo "*** Running makemigrations --check to make sure migrations are up to date..."
django-admin makemigrations --noinput --check 2>&1 || exit 1
echo "*** Running migrate to apply migrations..."
django-admin migrate --noinput 2>&1
echo "*** Clearing django cache..."
django-admin clear_cache 2>&1
echo "*** Running collectstatic..."
django-admin collectstatic -c --no-input 2>&1
echo "*** Marking as deployed..."
touch /flags/.deployed
echo "*** Deployed successfully!"