After enabling Artifact Registry, Run this command
gcloud auth configure-docker
After creating a Repo in artifactory, use this command to build and upload to it:
gcloud builds submit --tag $(GCR_HOST)/$(PROJECT_ID)/$(REPO)/$(SERVICE):latest .
Here’s my Makefile:
HOST := us-docker.pkg.dev
REGION := us-central1
PROJECT_ID := my-project
REPO := my-repo
SERVICE := my-service
include Makefile.env
all: gcp-setup cloud-build cloud-run-deploy
gcp-setup:
gcloud config set project $(PROJECT_ID)
cloud-build:
gcloud auth configure-docker $(HOST)
gcloud builds submit --tag $(HOST)/$(PROJECT_ID)/$(REPO)/$(SERVICE):latest .
cloud-run-deploy:
gcloud config set run/region $(REGION)
gcloud run deploy $(SERVICE) --image $(HOST)/$(PROJECT_ID)/$(REPO)/$(SERVICE):latest