在构建有角度的应用程序的docker映像的ng build --prod步骤中,我遇到以下错误。
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
这是我的dockerfile的样子。
##### Stage 1
FROM node:latest as node
LABEL author="David Andrews"
WORKDIR /app
COPY package.json package.json
RUN npm install
COPY . .
RUN npm run build -- --prod
##### Stage 2
FROM nginx:alpine
VOLUME /var/cache/nginx
COPY --from=node /app/dist /usr/share/nginx/html
COPY ./config/nginx.conf /etc/nginx/conf.d/default.conf
当我运行针对prod的构建时,不会发生此错误,仅当构建docker映像时才会发生。我曾尝试增加内存限制,但该方法工作了几次,但随后又开始失败。