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/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
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
|
USER nextjs
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
@@ -51,6 +67,5 @@ ENV PORT 3000
|
|||||||
# set hostname to localhost
|
# set hostname to localhost
|
||||||
ENV HOSTNAME "0.0.0.0"
|
ENV HOSTNAME "0.0.0.0"
|
||||||
|
|
||||||
# server.js is created by next build from the standalone output
|
# Run migrations then start server
|
||||||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
|
CMD ["/bin/sh", "/app/entrypoint.sh"]
|
||||||
CMD ["node", "server.js"]
|
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: minio/minio
|
image: bitnami/minio:latest
|
||||||
container_name: portal_transparencia_minio
|
container_name: portal_transparencia_minio
|
||||||
environment:
|
environment:
|
||||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-admin}
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-admin}
|
||||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-password123}
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-password123}
|
||||||
command: server /data --console-address ":9001"
|
MINIO_DEFAULT_BUCKETS: ${MINIO_BUCKET:-portal-transparencia}
|
||||||
volumes:
|
volumes:
|
||||||
- minio_data:/data
|
- minio_data:/bitnami/minio/data
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user