Modificar Dockerfile

This commit is contained in:
Bxio 2025-07-04 13:35:32 +00:00
parent 37313af8e2
commit d531a6a430

View File

@ -1,35 +1,23 @@
# Etapa 1: Build # Use an official Node runtime as a parent image
FROM node:20-slim AS builder FROM node:16
# Define diretório de trabalho # Set the working directory to /app
WORKDIR /app WORKDIR /app
# Copiar package.json e lock # Copy the package.json and package-lock.json to the working directory
COPY package*.json ./ COPY ./package*.json ./
# Instalar dependências # Install the dependencies
RUN npm install RUN npm install
# Copiar resto do código para dentro da imagem # Copy the remaining application files to the working directory
COPY . . COPY . .
# Build de produção # Build the application
RUN npm run build RUN npm run build
# Etapa 2: Production runner # Expose port 3000 for the application
FROM node:20-slim AS runner
WORKDIR /app
# Copiar só o necessário
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/node_modules ./node_modules
# Definir a porta que o Next.js vai usar
EXPOSE 3000 EXPOSE 3000
# Comando default # Start the application
CMD ["npm", "start"] CMD [ "npm", "run", "start" ]