Atualizar dockerfile
This commit is contained in:
20
dockerfile
20
dockerfile
@ -3,33 +3,27 @@ FROM node:18-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiar apenas os arquivos necessários para instalar dependências
|
||||
# Copiar arquivos de configuração
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# Copiar o resto dos arquivos
|
||||
COPY . .
|
||||
|
||||
# Gerar prisma client e fazer build
|
||||
# Instalar dependências e build
|
||||
RUN npm install
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
# Production stage - imagem muito mais leve
|
||||
# Production stage
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiar apenas o necessário do builder
|
||||
COPY --from=builder /app/.next ./.next
|
||||
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
|
||||
COPY --from=builder /app/package*.json ./
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
|
||||
# Instalar apenas dependências de produção
|
||||
RUN npm install --production
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user