Skip to content

Commit

Permalink
feat: update dockerfile and entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dahal committed May 18, 2024
1 parent 1c33681 commit 5e18b2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 3 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# copy prisma and migrate script
COPY --from=builder --chown=nextjs:nodejs /app/scripts/migrate.sh ./scripts/migrate.sh
COPY --from=builder --chown=nextjs:nodejs /app/docker/entrypoint.sh ./docker/entrypoint.sh
COPY --from=builder --chown=nextjs:nodejs /app/prisma/schema.prisma ./prisma/schema.prisma
COPY --from=builder --chown=nextjs:nodejs /app/prisma/migrations ./prisma/migrations

Expand All @@ -71,9 +71,5 @@ EXPOSE 3000
ENV PORT 3000

# Run the migration script
RUN chmod +x ./scripts/migrate.sh
ENTRYPOINT [ "./scripts/migrate.sh" ]

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js
RUN chmod +x ./docker/entrypoint.sh
ENTRYPOINT [ "./docker/entrypoint.sh" ]
7 changes: 7 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Run database migrations
npx prisma migrate deploy

# Run the server
HOSTNAME="0.0.0.0" node server.js
3 changes: 0 additions & 3 deletions scripts/migrate.sh

This file was deleted.

0 comments on commit 5e18b2f

Please sign in to comment.