Files
polylan-submitter/deploy/docker/entrypoint.sh
T

24 lines
899 B
Bash

#!/usr/bin/env bash
# Container entrypoint: runs migrations (unless disabled), then execs
# whatever CMD supplied (supervisord by default - see the Dockerfile).
#
# collectstatic is intentionally NOT run here: it pushes to the shared S3
# bucket (see STORAGES in settings.py), so running it on every container
# start would race across replicas for no benefit - run it once per deploy
# instead:
# docker run --rm --env-file <env file> polylan-submitter \
# python manage.py collectstatic --noinput
set -euo pipefail
if [ "${MIGRATE_ON_START:-true}" = "true" ]; then
echo "Running migrations..."
python manage.py migrate --noinput
fi
# Kick off the periodic Steam store refresh (games.tasks). No-op when a refresh
# is already queued, so every replica can safely run it on start.
python manage.py schedule_steam_refresh || echo "Could not schedule Steam store refresh"
exec "$@"