32 lines
507 B
Docker
32 lines
507 B
Docker
# Build stage
|
|
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copiar package files
|
|
COPY package*.json ./
|
|
|
|
# Instalar dependencias
|
|
RUN npm install
|
|
|
|
# Copiar código fuente
|
|
COPY . .
|
|
|
|
# Build de producción
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copiar build al nginx
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copiar configuración de nginx
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Exponer puerto 80
|
|
EXPOSE 80
|
|
|
|
# Comando por defecto
|
|
CMD ["nginx", "-g", "daemon off;"]
|