32 lines
722 B
Docker
32 lines
722 B
Docker
# Etapa 1 - Build da aplicação Vite
|
|
FROM node:18 AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Copiar o ZIP para dentro do container
|
|
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
|
|
|
|
# (opcional para debug: ver se o package.json está aqui)
|
|
# RUN ls -la && ls -la src
|
|
|
|
# Instalar dependências e buildar
|
|
RUN npm install && npm run build
|
|
|
|
# Etapa 2 - Servir com NGINX
|
|
FROM nginx:alpine
|
|
|
|
# Copiar a pasta dist gerada pelo Vite
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Remover index default do nginx, se existir
|
|
RUN rm -f /usr/share/nginx/html/index.html 2>/dev/null || true
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|