From 7e9bf4f9961c8a0fde5975dc1080e81e62307c0e Mon Sep 17 00:00:00 2001 From: wander Date: Fri, 21 Nov 2025 21:04:27 +0000 Subject: [PATCH] Atualizar Dockerfile --- Dockerfile | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9e639b..f4f03f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,41 @@ -# Etapa 1 - Build da aplicação Vite -FROM node:18 AS build +# ========================= +# Etapa 1 - Build Vite +# ========================= +FROM node:20-alpine AS build +# Diretório de trabalho WORKDIR /app -# Copiar o ZIP para dentro do container +# Instalar unzip +RUN apk add --no-cache unzip + +# Copiar o ZIP COPY app.zip . -# Instalar unzip e extrair diretamente em /app -RUN apt-get update && apt-get install -y unzip && \ - unzip app.zip -d . && \ - rm app.zip +# Descompactar conteúdo diretamente em /app +RUN unzip app.zip -d . && rm app.zip -# (opcional para debug: ver se o package.json está aqui) -# RUN ls -la && ls -la src +# (DEBUG OPCIONAL: ver se o package.json está aqui) +# RUN pwd && ls -la && ls -la src # Instalar dependências e buildar -RUN npm install && npm run build +# Se quiser pode trocar npm ci por npm install +RUN npm ci || npm install +RUN npm run build -# Etapa 2 - Servir com NGINX +# ========================= +# Etapa 2 - Nginx estático +# ========================= FROM nginx:alpine -# Copiar a pasta dist gerada pelo Vite -COPY --from=build /app/dist /usr/share/nginx/html +# Remover completamente a página padrão do nginx +RUN rm -rf /usr/share/nginx/html/* -# Remover index default do nginx, se existir -RUN rm -f /usr/share/nginx/html/index.html 2>/dev/null || true +# Copiar o build do Vite +COPY --from=build /app/dist/ /usr/share/nginx/html/ + +# (DEBUG OPCIONAL: ver o que ficou na pasta pública) +# RUN ls -R /usr/share/nginx/html EXPOSE 80