feat: run prisma migrate deploy on container startup
This commit is contained in:
@@ -67,11 +67,12 @@ COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/tsconfig.json ./tsconfig.json
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/src ./src
|
||||
COPY entrypoint.sh ./entrypoint.sh
|
||||
|
||||
# Env vars runtime dikelola oleh Portainer (stack env / container env).
|
||||
# Tidak perlu copy .env ke runner — image tetap bersih tanpa secrets.
|
||||
|
||||
RUN chown -R nextjs:nodejs /app
|
||||
RUN chown -R nextjs:nodejs /app && chmod +x entrypoint.sh
|
||||
|
||||
USER nextjs
|
||||
|
||||
@@ -80,4 +81,5 @@ EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
CMD ["bun", "run", "start"]
|
||||
8
entrypoint.sh
Normal file
8
entrypoint.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "⏳ Menjalankan migrasi database..."
|
||||
./node_modules/.bin/prisma migrate deploy
|
||||
echo "✅ Migrasi selesai."
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user