I have been running a cloud build service which deploys a nextjs application to a cloud run container for a year now. This week, after making some commits, I was unable to successfully deploy the changes even though I have not changed anything on GCP. On cloud build, the error reads:
"Deploy": ERROR: (gcloud.run.services.update) Cloud Run error: The user-provided container failed to start and listen on the port defined provided by the PORT=3000 environment variable. Logs for this revision might contain more information.
after it downloads this image
ERROR: build step 2 "gcr.io/google.com/cloudsdktool/cloud-sdk:slim" failed: step exited with non-zero status: 1
My steps on my cloudbuild.yaml file have been:
download .env file
build the container image
push the container image to gcr
deploy container image to Cloud Run Anthos
I have even increased my timeout to 900s because that is the first error that I received. These steps have successfully deployed the application in the past and I have only changed the timeout time in cloudbuild.yaml
My dockerfile only has the following:
FROM node:14-alpine
WORKDIR /app
COPY . .
RUN npm install
RUN npm rebuild node-sass
RUN npm run build
EXPOSE 3000
CMD ["npm","start"]