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
FROM node:20-slim AS builder
# Use an official Node runtime as a parent image
FROM node:16
# Define diretório de trabalho
# Set the working directory to /app
WORKDIR /app
# Copiar package.json e lock
COPY package*.json ./
# Copy the package.json and package-lock.json to the working directory
COPY ./package*.json ./
# Instalar dependências
# Install the dependencies
RUN npm install
# Copiar resto do código para dentro da imagem
# Copy the remaining application files to the working directory
COPY . .
# Build de produção
# Build the application
RUN npm run build
# Etapa 2: Production runner
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 port 3000 for the application
EXPOSE 3000
# Comando default
CMD ["npm", "start"]
# Start the application
CMD [ "npm", "run", "start" ]