# Estágio de Build
FROM bitnami/node:22 as build-stage
RUN apt-get update && apt-get upgrade -y && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package*.json ./
RUN npm install --frozen-lockfile || npm install
COPY . .
RUN npm run build

# Estágio de Produção
FROM bitnami/node:22 as production-stage
WORKDIR /app
COPY --from=build-stage /app/dist ./dist
COPY server.js ./
EXPOSE 8080
CMD ["node", "server.js"]
