Automate database migrations on Docker startup for production

Update Dockerfile and entrypoint script to automatically run database migrations and apply schema changes upon container initialization.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: f9197b9b-a5b3-4469-a27d-930a9e9ee736
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/f9197b9b-a5b3-4469-a27d-930a9e9ee736/i2gFnxm
This commit is contained in:
michaelschal committed 2025-08-18 09:39:20 +00:00
1 parent f55a7a6217
commit a2554c4962
4 files changed
+98 -32

No files matched your search

+5 -3
View File
@@ -107,8 +107,10 @@ USER nextjs
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
# Make migration script executable
RUN chmod +x /app/scripts/auto-migrate-production.sh
# Make scripts executable
RUN chmod +x /app/scripts/auto-migrate-production.sh && \
chmod +x /app/scripts/docker-entrypoint.sh
# Start the application normally (migration will be manual or via init script)
# Use entrypoint script for automatic migrations
ENTRYPOINT ["/app/scripts/docker-entrypoint.sh"]
CMD ["node", "dist/index.js"]