@@ -27,11 +27,15 @@ FROM node:22-bookworm-slim AS build
2727# Set Python interpreter for `node-gyp` to use
2828ENV PYTHON=/usr/bin/python3
2929
30+ # Critical: Increase memory and timeout for ARM64 cross-compilation
31+ ENV NODE_OPTIONS="--max-old-space-size=8192"
32+ ENV YARN_NETWORK_TIMEOUT=300000
33+
3034# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
3135RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
3236 --mount=type=cache,target=/var/lib/apt,sharing=locked \
3337 apt-get update && \
34- apt-get install -y --no-install-recommends python3 g++ build-essential && \
38+ apt-get install -y --no-install-recommends python3 g++ build-essential git && \
3539 rm -rf /var/lib/apt/lists/*
3640
3741# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
@@ -47,8 +51,8 @@ WORKDIR /app
4751
4852COPY --from=packages --chown=node:node /app .
4953
50- RUN --mount=type= cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
51- yarn install --immutable
54+ # Install with increased timeout and without cache mount to avoid cross-platform issues
55+ RUN yarn install --immutable --network-timeout 300000
5256
5357COPY --chown=node:node . .
5458
@@ -99,9 +103,7 @@ COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packag
99103# Note: The skeleton bundle only includes package.json files -- if your app has
100104# plugins that define a `bin` export, the bin files need to be copied as well to
101105# be linked in node_modules/.bin during yarn install.
102-
103- RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
104- yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)"
106+ RUN yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)"
105107
106108# Copy the built packages from the build stage
107109COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./
0 commit comments