This is my first time dealing with the Google Cloud with my nodejs with WebSocket program, so I definitely expect a lot of errors to show up along the way as I learn how the process works. Right now, I am stuck at an error that seems to be an issue with the cloud run getting information from the cloudfile when Cloud Run is trying to deploy. "ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1".
I just use the default cloudbuild that the Google Cloud Run documents have. cloudbuild documentation This cloudfile is in the root directory of the project with the Dockerfile that the docker program generated for my project.
cloudbuild.yaml
steps:
# Docker Build
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'us-central1-docker.pkg.dev/game-gossip-409604/gamegossip-server/gamegossip', '--network=cloudbuild', '.']
# Docker Push
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'us-central1-docker.pkg.dev/game-gossip-409604/gamegossip-server/gamegossip', '--network=cloudbuild']
# Entrypoint, timeout and environment variables
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
timeout: 240s
args: ['compute', 'instances',
'create-with-container', 'my-vm-name',
'--container-image',
'us-central1-docker.pkg.dev/game-gossip-409604/gamegossip-server/gamegossip']
env:
- 'CLOUDSDK_COMPUTE_REGION=us-central1'
- 'CLOUDSDK_COMPUTE_ZONE=us-central1-a'
Dockerfile
ARG NODE_VERSION=20.10.0
FROM node:${NODE_VERSION}-alpine
ENV NODE_ENV production
WORKDIR /usr/src/app
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci --omit=dev
USER node
COPY . .
EXPOSE 8080
CMD node server.js
The program/Dockerfile work perfectly when running locally, so I assume it is just an issue of how the files are transferred to the Google Cloud Run. I have tried looking at other people's post that have the same error message, but for each case it seems the solution is highly individualized. I figured with mine it is just a simple file or line of code that I am missing, but I am unable to find out what that missing piece is. I appreciate any help.