25 lines
578 B
Docker
25 lines
578 B
Docker
# Etapa de build de Vite
|
|
FROM node:18-alpine AS build
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Etapa final con Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copia la app compilada
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Copia script que genera config.js en base a variables de entorno
|
|
COPY runtime-env.sh /docker-entrypoint.d/
|
|
|
|
#Darle permisos de ejecución al script
|
|
RUN chmod +x /docker-entrypoint.d/runtime-env.sh
|
|
|
|
# Copia configuración de Nginx para asegurar que sirva correctamente la app
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|