wrongmove/frontend/Dockerfile
Viktor Barzin fd4864fd03
Fix frontend build OOM: skip tsc, use vite only, bump memory limits
- Replace `npm run build` (tsc -b && vite build) with `npx vite build`
  in Dockerfile since Vite transpiles via SWC independently of tsc.
  Type-checking is already done in the test step.
- Set Node heap to 1024MB (was 384MB which OOMed even for Vite)
- Bump Drone pod memory: requests 1.5Gi, limits 3Gi to cover
  plugins/docker overhead
2026-02-11 22:59:12 +00:00

32 lines
798 B
Docker

# Stage 1: Build the React app
FROM node:24-alpine AS builder
WORKDIR /app
# Copy package files first for better caching
COPY package.json package-lock.json* ./
# Install dependencies (prefers yarn if available)
RUN npm ci
# Copy all files and build
COPY . .
# Limit Node.js heap to avoid OOM in constrained CI environments
ENV NODE_OPTIONS="--max-old-space-size=1024"
# Skip tsc type-checking (already done in test step); Vite transpiles via SWC
RUN npx vite build
FROM nginx:alpine
# Remove default nginx static files
RUN rm -rf /usr/share/nginx/html/*
WORKDIR /app
# Copy only necessary files from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]