fleet-platform/scripts/entrypoint.sh

24 lines
684 B
Bash
Raw Normal View History

#!/bin/sh
set -eu
# Fall back to the git SHA baked into the image at build time when the runtime
# env didn't supply a real one. Coolify builds from source and injects
# SOURCE_COMMIT="unknown", so without this /health would always report
# image_sha="unknown".
if [ -z "${APP_GIT_SHA:-}" ] || [ "${APP_GIT_SHA}" = "unknown" ]; then
APP_GIT_SHA="$(cat /etc/git_sha 2>/dev/null || echo unknown)"
export APP_GIT_SHA
fi
ROLE="${APP_ROLE:-gateway}"
case "$ROLE" in
gateway|worker|cron)
exec uvicorn "app.entrypoints.${ROLE}:app" --host 0.0.0.0 --port 8000
;;
*)
echo "entrypoint: unknown APP_ROLE='$ROLE' (expected gateway|worker|cron)" >&2
exit 64
;;
esac