27 lines
585 B
Docker
27 lines
585 B
Docker
# Etapa 1: Construcción del frontend
|
|
FROM node:18-alpine AS build-stage
|
|
|
|
WORKDIR /app
|
|
|
|
# Instalar dependencias
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
# Copiar el resto de archivos y construir
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Etapa 2: Servidor Nginx para producción
|
|
FROM nginx:alpine
|
|
|
|
# Copiar archivos construidos desde la etapa anterior
|
|
COPY --from=build-stage /app/dist/ /usr/share/nginx/html/
|
|
|
|
# Copiar configuración personalizada de Nginx
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Exponer el puerto configurado en nginx.conf
|
|
EXPOSE 9112
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|