Dashboard Leads - version limpia para servidor (.env y config de despliegue restaurados)

This commit is contained in:
Panchito
2026-08-20 11:00:14 -05:00
parent 514bcbda45
commit 9a73e95ae5
4 changed files with 99 additions and 0 deletions

6
frontend/.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
node_modules
dist
.env.local
npm-debug.log*
Dockerfile
.dockerignore

20
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
# ── Etapa 1: build del frontend con Vite ──
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci --no-audit --no-fund || npm install --no-audit --no-fund
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;"]

37
frontend/nginx.conf Normal file
View File

@@ -0,0 +1,37 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Compresion
gzip on;
gzip_types text/plain text/css application/json application/javascript
text/xml application/xml application/xml+rss text/javascript
image/svg+xml;
gzip_min_length 1024;
# Cache larga para los assets con hash en el nombre
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# SPA: cualquier ruta desconocida devuelve index.html
location / {
try_files $uri $uri/ /index.html;
}
# index.html nunca se cachea, para que los deploys se vean al instante
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
internal;
}
}