fix: use bitnami/minio for CPU compatibility and add auto migrations
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -43,6 +43,22 @@ RUN chown nextjs:nodejs .next
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
# Copy Prisma files for migrations
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||
|
||||
# Install prisma CLI for migrations
|
||||
RUN npm install -g prisma
|
||||
|
||||
# Create entrypoint script
|
||||
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
|
||||
echo 'echo "Running database migrations..."' >> /app/entrypoint.sh && \
|
||||
echo 'npx prisma migrate deploy' >> /app/entrypoint.sh && \
|
||||
echo 'echo "Starting application..."' >> /app/entrypoint.sh && \
|
||||
echo 'exec node server.js' >> /app/entrypoint.sh && \
|
||||
chmod +x /app/entrypoint.sh
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
@@ -51,6 +67,5 @@ ENV PORT 3000
|
||||
# set hostname to localhost
|
||||
ENV HOSTNAME "0.0.0.0"
|
||||
|
||||
# server.js is created by next build from the standalone output
|
||||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
|
||||
CMD ["node", "server.js"]
|
||||
# Run migrations then start server
|
||||
CMD ["/bin/sh", "/app/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user