chore: add Docker config for Dokploy deploy

This commit is contained in:
2026-06-02 23:43:19 -03:00
parent 8a9ce7ae04
commit 0e089155da
4 changed files with 58 additions and 0 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
node_modules
dist
.env*
.git
tests
*.md

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
# Stage 1: build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
# Variables de entorno inyectadas como build args desde Dokploy
ARG VITE_SUPABASE_URL
ARG VITE_SUPABASE_ANON_KEY
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
RUN npm run build
# Stage 2: serve
FROM nginx:alpine
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;"]

6
docs/.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
node_modules
dist
.env*
.git
tests
*.md

25
nginx.conf Normal file
View File

@@ -0,0 +1,25 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
# SPA routing — todas las rutas van a index.html
location / {
try_files $uri $uri/ /index.html;
}
# Cache agresivo para assets con hash en el nombre
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# No cachear index.html
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
gzip_min_length 1000;
}