29 lines
706 B
Docker
29 lines
706 B
Docker
# Etapa de construcción
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copiar archivos de dependencias
|
|
COPY package*.json ./
|
|
RUN apk update && apk add --no-cache ca-certificates wget && update-ca-certificates
|
|
RUN npm config set strict-ssl false
|
|
# Instalar todas las dependencias para construcción
|
|
RUN npm ci
|
|
|
|
# Copiar el resto del código
|
|
COPY . .
|
|
|
|
# Crear archivo .env
|
|
RUN echo "VITE_API_BASE_URL=http://localhost:8009" > .env
|
|
|
|
# Construir la aplicación
|
|
RUN npm run build
|
|
|
|
# Etapa de producción
|
|
FROM nginx:alpine AS production
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"] |