Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

building React app very slow on Cloud Build

I have a CD/CI pipeline on Cloud Build for a React app:

 

id: Build docker image
name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'us-central1-docker.pkg.dev/$PROJECT_ID/.../...-cloudbuild:$SHORT_SHA', '.' ]

 

This kicks off the Dockerfile of the React app:

 

FROM node:16.19.1 AS ui-build
WORKDIR /usr/src/app
COPY . .
RUN npm install --force
RUN npm run build --verbose

FROM nginx:alpine
COPY --from=ui-build /usr/src/app/build/ /usr/share/nginx/html

ENTRYPOINT ["sh", "-c", "cd /usr/share/nginx/html/ && ./set-env.sh && nginx -g 'daemon off;'"]

 

The npm run build command takes about 25 minutes to complete. The verbose flag didn't give out anything useful. Did anyone experience this? Is it because the build instance that runs this is too basic?

0 1 1,371
1 REPLY 1