File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,10 @@ ENV PRISMA_LOG_LEVEL=info
1919
2020RUN mkdir -p /challenge-api/reports
2121
22- CMD ["node" ,"/challenge-api/app.js" ]
22+ # Copy entrypoint script and make it executable
23+ COPY docker/entrypoint.sh /entrypoint.sh
24+ RUN chmod +x /entrypoint.sh
25+
26+ # Use entrypoint to run migrations at startup (not build time)
27+ # Prisma uses PostgreSQL advisory locks to prevent concurrent migrations
28+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ echo " Starting Challenge API v6..."
5+
6+ # Run database migrations
7+ # Prisma uses PostgreSQL advisory locks to prevent concurrent migrations
8+ # Only one instance will run migrations, others will wait
9+ echo " Running database migrations..."
10+ npx prisma migrate deploy
11+
12+ # Check migration status
13+ if [ $? -eq 0 ]; then
14+ echo " Migrations completed successfully"
15+ else
16+ echo " Migration failed with exit code $? "
17+ exit 1
18+ fi
19+
20+ # Start the application
21+ echo " Starting application server..."
22+ exec node /challenge-api/app.js
You can’t perform that action at this time.
0 commit comments