react/Dockerfile
2025-07-05 11:10:51 +00:00

35 lines
659 B
Docker
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

############################
# 1⃣ BUILD STAGE
############################
FROM node:20-alpine AS builder
# Define diretório de trabalho
WORKDIR /app
# Copia os manifests de dependências
COPY package*.json ./
# Instala dependências
RUN npm install
# Copia o restante do código
COPY . .
# Builda para produção
RUN npm run build
############################
# 2⃣ NGINX STAGE
############################
FROM nginx:alpine
# Copia o build pronto para a pasta que o NGINX serve
COPY --from=builder /app/dist /usr/share/nginx/html
# Exponha a porta padrão do NGINX
EXPOSE 80
# Comando default do NGINX
CMD ["nginx", "-g", "daemon off;"]