go-guess/docker/entrypoint.sh
Daniel Noulet 79e09f049f test: add full application BDD suite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-20 09:13:48 +02:00

27 lines
530 B
Bash
Executable file

#!/bin/sh
set -eu
shutdown() {
trap - TERM INT
kill -TERM "$api_pid" "$nginx_pid" 2>/dev/null || true
wait "$api_pid" "$nginx_pid" 2>/dev/null || true
exit 0
}
goose -dir /app/migrations postgres "$DATABASE_URL" up
seed
api &
api_pid=$!
nginx -e /dev/stderr -g 'daemon off;' &
nginx_pid=$!
trap shutdown TERM INT
while kill -0 "$api_pid" 2>/dev/null && kill -0 "$nginx_pid" 2>/dev/null; do
sleep 1
done
kill -TERM "$api_pid" "$nginx_pid" 2>/dev/null || true
wait "$api_pid" "$nginx_pid" 2>/dev/null || true
exit 1