feat: migración a PostgreSQL, tiempo real SSE, Dockerfile y compose para Coolify

This commit is contained in:
urieljareth
2026-08-13 15:01:58 -06:00
commit f7fded5a44
28 changed files with 7314 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
# ==========================================
# STAGE 1: Build Frontend & Server Bundle
# ==========================================
FROM node:22-alpine AS builder
WORKDIR /app
# Instalar dependencias completas para build
COPY package*.json ./
RUN npm ci
# Copiar código fuente
COPY . .
# Compilar frontend (Vite) y backend (esbuild)
RUN npm run build
# ==========================================
# STAGE 2: Imagen Ligera de Producción
# ==========================================
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
# Instalar únicamente dependencias de producción
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force
# Copiar artefactos compilados del builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/dist-server ./dist-server
# Exponer puerto de la aplicación
EXPOSE 3000
# Health check nativo de Docker
HEALTHCHECK --interval=20s --timeout=5s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/health || exit 1
# Iniciar servidor Express optimizado
CMD ["node", "dist-server/index.js"]