michangarrito/apps/frontend/Dockerfile
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- database/ (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:02 -06:00

64 lines
1.6 KiB
Docker

# =============================================================================
# MiChangarrito - Frontend Dockerfile
# =============================================================================
# Multi-stage build for React + Vite application
# Served by nginx
# Puerto: 80 (interno) -> 3140 (host)
# =============================================================================
# Build stage
FROM node:20-alpine AS builder
# Build argument for API URL
ARG VITE_API_URL=http://localhost:3141/api/v1
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Set environment variable for build
ENV VITE_API_URL=$VITE_API_URL
# Build application
RUN npm run build
# Production stage with nginx
FROM nginx:alpine AS production
# Labels
LABEL maintainer="ISEM"
LABEL description="MiChangarrito Frontend Web"
LABEL version="1.0.0"
# Copy custom nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy built assets from builder
COPY --from=builder /app/dist /usr/share/nginx/html
# Create non-root user
RUN addgroup -g 1001 -S nginx-user && \
adduser -S nginx-user -u 1001 -G nginx-user && \
chown -R nginx-user:nginx-user /usr/share/nginx/html && \
chown -R nginx-user:nginx-user /var/cache/nginx && \
chown -R nginx-user:nginx-user /var/log/nginx && \
touch /var/run/nginx.pid && \
chown -R nginx-user:nginx-user /var/run/nginx.pid
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80 || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]