c784b4b378
Installs postgresql-client in the dev image so pg_isready is available. The startup script now polls until postgres accepts connections, preventing the P1001 "can't reach database" crash when the app container starts before postgres is fully ready. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
977 B
Bash
32 lines
977 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
# Wait for postgres to be ready before running migrations
|
|
echo "Waiting for postgres..."
|
|
until pg_isready -h "${POSTGRES_HOST:-postgres}" -p "${POSTGRES_PORT:-5432}" -q; do
|
|
sleep 1
|
|
done
|
|
echo "Postgres is ready."
|
|
|
|
# Regenerate Prisma client (needed after bind-mount overlays the image layer)
|
|
pnpm --filter @capakraken/db db:generate
|
|
|
|
# Run pending migrations so a fresh checkout boots against a current schema
|
|
pnpm --filter @capakraken/db db:migrate:deploy
|
|
|
|
pnpm check:exports
|
|
pnpm check:imports
|
|
|
|
repo_uid="$(stat -c '%u' /app)"
|
|
repo_gid="$(stat -c '%g' /app)"
|
|
repo_home="/tmp/capakraken-dev-home"
|
|
|
|
mkdir -p /app/apps/web/.next
|
|
mkdir -p "$repo_home/.config/pnpm"
|
|
chown -R "$repo_uid:$repo_gid" /app/apps/web/.next
|
|
chown -R "$repo_uid:$repo_gid" "$repo_home"
|
|
|
|
exec setpriv --reuid="$repo_uid" --regid="$repo_gid" --clear-groups \
|
|
env HOME="$repo_home" XDG_CONFIG_HOME="$repo_home/.config" \
|
|
pnpm --filter @capakraken/web exec next dev -H 0.0.0.0 -p 3100
|