July 30, 2026
GCP Container vs Artifact
A guide to GCP Container vs Artifact
When creating a Cloud Build, you have the option of using a Dockerfile which creates a container, or using a yaml file which creates an artifact.
FROM node:18-slimENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"RUN apt-get update && apt-get install gnupg wget -y && \wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \apt-get update && \apt-get install google-chrome-stable -y --no-install-recommends && \rm -rf /var/lib/apt/lists/*RUN apt-get update && apt-get install -y bash curl && curl -1sLf \'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash \&& apt-get update && apt-get install -y infisical=0.24.0COPY . .RUN npm installRUN npm run buildEXPOSE 8000CMD ["infisical","run", "--", "node", "dist/server.js"]
steps:# In this step, we build the container- name: gcr.io/cloud-builders/dockerargs:- build- '--no-cache'- '-t'- >-$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA- .- '-f'- dockerfileid: Build# In this step, we push the container to the artifact registry- name: gcr.io/cloud-builders/dockerargs:- push- >-$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHAid: Push# In this step, we update the cloud run service to use the new container- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'args:- run- services- update- $_SERVICE_NAME- '--platform=managed'- >---image=$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA- >---labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID- '--region=$_DEPLOY_REGION'- '--quiet'id: Deployentrypoint: gcloudimages:- >-$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHAoptions:substitutionOption: ALLOW_LOOSElogging: CLOUD_LOGGING_ONLYsubstitutions:_DEPLOY_REGION: us-central1_AR_HOSTNAME: us-central1-docker.pkg.dev_PLATFORM: managed_TRIGGER_ID:_SERVICE_NAME:tags:- gcp-cloud-build-deploy-cloud-run- gcp-cloud-build-deploy-cloud-run-managed