Adicionar script de inicialização automático com migrations
This commit is contained in:
@@ -41,6 +41,11 @@ COPY --from=builder /app/.next/static ./.next/static
|
|||||||
COPY --from=builder /app/prisma ./prisma
|
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
|
||||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||||
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
|
||||||
|
# Copiar script de inicialização
|
||||||
|
COPY start.sh /app/start.sh
|
||||||
|
RUN chmod +x /app/start.sh
|
||||||
|
|
||||||
# Configurar permissões
|
# Configurar permissões
|
||||||
RUN chown -R nextjs:nodejs /app
|
RUN chown -R nextjs:nodejs /app
|
||||||
@@ -56,4 +61,4 @@ ENV PORT=3000
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
# Comando de inicialização
|
# Comando de inicialização
|
||||||
CMD ["node", "server.js"]
|
CMD ["/app/start.sh"]
|
||||||
|
|||||||
11
frontend/start.sh
Normal file
11
frontend/start.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "🔄 Executando migrations do Prisma..."
|
||||||
|
npx prisma db push --accept-data-loss
|
||||||
|
|
||||||
|
echo "🌱 Executando seed..."
|
||||||
|
npx prisma db seed || echo "⚠️ Seed falhou ou já foi executado"
|
||||||
|
|
||||||
|
echo "🚀 Iniciando aplicação..."
|
||||||
|
exec node server.js
|
||||||
Reference in New Issue
Block a user