managarten/apps/zitare/apps/backend/docker-entrypoint.sh
Till-JS c54ff859d6 🚀 feat(zitare): add Docker deployment infrastructure
- Add Dockerfile for zitare-backend (multi-stage build, port 3007)
- Add docker-entrypoint.sh for database setup
- Add zitare-backend service to docker-compose.macmini.yml
- Update matrix-zitare-bot to depend on zitare-backend
- Add zitare-backend to CI workflow (change detection + build job)
2026-02-13 13:49:15 +01:00

36 lines
935 B
Bash

#!/bin/sh
set -e
echo "=== Zitare Backend Entrypoint ==="
# Wait for PostgreSQL to be ready
echo "Waiting for PostgreSQL..."
until pg_isready -h ${DB_HOST:-postgres} -p ${DB_PORT:-5432} -U ${DB_USER:-zitare} 2>/dev/null; do
echo "PostgreSQL is unavailable - sleeping"
sleep 2
done
echo "PostgreSQL is up!"
cd /app/apps/zitare/apps/backend
# Run schema push (for development) or migrations (for production)
if [ "$NODE_ENV" = "production" ] && [ -d "src/db/migrations/meta" ]; then
echo "Running database migrations..."
npx tsx src/db/migrate.ts
echo "Migrations completed!"
else
echo "Pushing database schema (development mode)..."
npx drizzle-kit push --force
echo "Schema push completed!"
fi
# Run seed if seed file exists
if [ -f "src/db/seed.ts" ]; then
echo "Running database seed..."
npx tsx src/db/seed.ts
echo "Seed completed!"
fi
# Execute the main command
echo "Starting application..."
exec "$@"