28 lines
542 B
Docker
28 lines
542 B
Docker
# Stage 1: Build
|
|
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR /appz
|
|
|
|
COPY package.json package-lock.json* ./
|
|
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve com Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copia build estático do stage anterior
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Remove configuração default do nginx
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
|
|
|
# Copia config customizada (você pode criar o arquivo nginx.conf ao lado do Dockerfile)
|
|
COPY nginx.conf /etc/nginx/conf.d/
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |