Fix frontend Docker build OOM: limit Node heap + request more memory
- 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
This commit is contained in:
parent
34f70b2ba4
commit
6492741757
2 changed files with 13 additions and 1 deletions
10
.drone.yml
10
.drone.yml
|
|
@ -23,6 +23,11 @@ steps:
|
||||||
|
|
||||||
- name: Cache builder stage
|
- name: Cache builder stage
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 1Gi
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
settings:
|
settings:
|
||||||
username: viktorbarzin
|
username: viktorbarzin
|
||||||
password:
|
password:
|
||||||
|
|
@ -38,6 +43,11 @@ steps:
|
||||||
|
|
||||||
- name: Build frontend image
|
- name: Build frontend image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 1Gi
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
settings:
|
settings:
|
||||||
username: viktorbarzin
|
username: viktorbarzin
|
||||||
password:
|
password:
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,13 @@ WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
|
|
||||||
# Install dependencies (prefers yarn if available)
|
# Install dependencies (prefers yarn if available)
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
# Copy all files and build
|
# Copy all files and build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Limit Node.js heap to avoid OOM in constrained CI environments
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=512"
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue