🎓 Initial commit: Math2 Platform - Plataforma de Álgebra Lineal PRO
✨ Características: - 45 ejercicios universitarios (Basic → Advanced) - Renderizado LaTeX profesional - IA generativa (Z.ai/DashScope) - Docker 9 servicios - Tests 123/123 pasando - Seguridad enterprise (JWT, XSS, Rate limiting) 🐳 Infraestructura: - Next.js 14 + Node.js 20 - PostgreSQL 15 + Redis 7 - Docker Compose completo - Nginx + SSL ready 📚 Documentación: - 5 informes técnicos completos - README profesional - Scripts de deployment automatizados Estado: Producción lista ✅
This commit is contained in:
87
docker/Dockerfile.frontend
Normal file
87
docker/Dockerfile.frontend
Normal file
@@ -0,0 +1,87 @@
|
||||
# ==================================================
|
||||
# MULTI-STAGE DOCKERFILE - FRONTEND (Next.js 14)
|
||||
# Next.js App Router + TypeScript + TailwindCSS
|
||||
# ==================================================
|
||||
|
||||
# --------------------------------------------------
|
||||
# STAGE 1: Dependencies
|
||||
# --------------------------------------------------
|
||||
FROM node:20-alpine AS deps
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies for native modules
|
||||
RUN apk add --no-cache libc6-compat
|
||||
|
||||
# Copy package files
|
||||
COPY frontend/package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci && \
|
||||
npm cache clean --force
|
||||
|
||||
# --------------------------------------------------
|
||||
# STAGE 2: Builder
|
||||
# --------------------------------------------------
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Copy dependencies from deps stage
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY frontend/package*.json ./
|
||||
|
||||
# Copy all source files
|
||||
COPY frontend/ ./
|
||||
|
||||
# Set environment for build
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Build Next.js application
|
||||
RUN npm run build
|
||||
|
||||
# --------------------------------------------------
|
||||
# STAGE 3: Production Runner (Standalone Mode)
|
||||
# --------------------------------------------------
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache curl wget
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S nextjs -u 1001
|
||||
|
||||
# Set environment
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Copy necessary files from builder
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package*.json ./
|
||||
|
||||
# Copy standalone output
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
# Switch to non-root user
|
||||
USER nextjs
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
||||
|
||||
# Start Next.js server
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
# --------------------------------------------------
|
||||
# METADATA
|
||||
# --------------------------------------------------
|
||||
LABEL maintainer="math-platform-builders"
|
||||
LABEL description="Math Platform Frontend (Next.js)"
|
||||
LABEL version="1.0.0"
|
||||
Reference in New Issue
Block a user