diff --git a/docker/Dockerfile b/docker/Dockerfile index a00b9ff01..1d7434d10 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 @@ -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" ] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 000000000..dd8a1f514 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Run database migrations +npx prisma migrate deploy + +# Run the server +HOSTNAME="0.0.0.0" node server.js diff --git a/scripts/migrate.sh b/scripts/migrate.sh deleted file mode 100644 index 2238aefb5..000000000 --- a/scripts/migrate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -npx prisma migrate deploy \ No newline at end of file