- Set NODE_OPTIONS=--max-old-space-size=512 in Dockerfile to cap tsc heap usage within constrained CI pods - Add resource requests (1Gi) and limits (2Gi) to frontend Docker build steps in Drone pipeline
31 lines
718 B
Docker
31 lines
718 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=512"
|
|
RUN npm run 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;"]
|