Files
Lucky_Wheel/apps/api/docker-entrypoint.sh
T
2026-09-11 00:00:36 +03:30

27 lines
879 B
Bash

#!/bin/sh
set -eu
echo "[api] starting entrypoint at $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "[api] node=$(node -v) cwd=$(pwd)"
echo "[api] release check: app.js=$(test -f app.js && echo yes || echo NO) prisma=$(test -f node_modules/prisma/build/index.js && echo yes || echo NO)"
if [ ! -f app.js ]; then
echo "[api] FATAL: app.js missing — release copy failed" >&2
exit 1
fi
if [ ! -f node_modules/prisma/build/index.js ]; then
echo "[api] FATAL: prisma CLI missing — commit apps/api/release/node_modules" >&2
ls -la node_modules 2>&1 || true
exit 1
fi
echo "[api] REDIS_HOST=${REDIS_HOST:-unset} REDIS_PORT=${REDIS_PORT:-unset}"
echo "[api] running prisma migrate deploy..."
node node_modules/prisma/build/index.js migrate deploy --schema=./prisma/schema.prisma
echo "[api] migrate done"
echo "[api] launching app.js on 0.0.0.0:${PORT:-3000}"
exec node app.js