Actualizar docker-compose.yml con sintaxis YAML corregida y puerto 80 para frontend

This commit is contained in:
Administrator
2026-08-29 13:00:33 -05:00
parent 54581c21ab
commit 15c577207d
63 changed files with 11740 additions and 2864 deletions

View File

@@ -1,20 +1,27 @@
# ── Etapa 1: build del frontend con Vite ──
FROM node:20-alpine AS build
# Usamos Node.js para compilar el proyecto
FROM node:18-alpine
# Creamos la carpeta de trabajo
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci --no-audit --no-fund || npm install --no-audit --no-fund
# Declaramos que recibiremos estos argumentos durante el build
ARG VITE_SUPABASE_URL
ARG VITE_SUPABASE_ANON_KEY
ARG VITE_API_URL
# Los convertimos en variables de entorno para que Vite los vea al compilar
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
ENV VITE_API_URL=$VITE_API_URL
# Copiamos los archivos de configuración e instalamos dependencias
COPY package*.json ./
RUN npm install
# Copiamos el código y construimos la web (ahora Vite sí verá las variables)
COPY . .
RUN npm run build
# ── Etapa 2: servir el build con nginx ──
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
# Instalamos el servidor estático y lo ejecutamos
RUN npm install -g serve
CMD ["serve", "-s", "dist", "-l", "5173"]