Atualizar Dockerfile
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -1,26 +1,27 @@
|
|||||||
# Etapa 1 - build da aplicação
|
# Etapa 1 - Build da aplicação Vite
|
||||||
FROM node:18 as build
|
FROM node:18 as build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Instalar unzip e descompactar o .zip
|
# Copiar o zip para dentro do container
|
||||||
COPY app.zip .
|
COPY app.zip .
|
||||||
|
|
||||||
|
# Instalar unzip e extrair o conteúdo
|
||||||
RUN apt-get update && apt-get install -y unzip && \
|
RUN apt-get update && apt-get install -y unzip && \
|
||||||
unzip app.zip -d unzip && \
|
unzip app.zip -d unzip && \
|
||||||
rm app.zip
|
rm app.zip
|
||||||
|
|
||||||
# Detectar o diretório correto e mover para /app
|
# Detectar e mover o conteúdo para /app
|
||||||
RUN mv unzip/* . && rm -rf unzip
|
RUN mv unzip/*/* ./ || mv unzip/* ./ && rm -rf unzip
|
||||||
|
|
||||||
# Rodar build da aplicação
|
# Instalar dependências e buildar
|
||||||
RUN npm install && npm run build
|
RUN npm install && npm run build
|
||||||
|
|
||||||
# Etapa 2 - servir com nginx
|
# Etapa 2 - Servir com NGINX
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Remover página padrão do nginx, se existir
|
|
||||||
RUN rm -f /usr/share/nginx/html/index.html.orig 2>/dev/null || true
|
RUN rm -f /usr/share/nginx/html/index.html.orig 2>/dev/null || true
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
Reference in New Issue
Block a user