02 β Artifact Registry
β Previous: 01 β GCP Project Setup
β Practically free. First 0.5 GB of storage per month is free. A typical Django image is ~200β300 MB, so early on you stay within the free tier. After that, storage costs $0.10/GB/month. Network traffic between Artifact Registry and Cloud Run in the same region is free.
What is Artifact Registry?
Artifact Registry is GCP's private container image registry β the place where Docker images are stored before they're deployed. Think of it like Docker Hub, but private and inside your GCP project.
When GitHub Actions builds a Docker image from your code, it pushes it here. When Cloud Run deploys, it pulls the image from here. The image never leaves GCP's network.
What is a Docker image?
A Docker image is a packaged, self-contained snapshot of your application: the Python runtime, all dependencies, your Django code, and the command to start the server β all bundled into a single file. Cloud Run takes this image and runs it as a container (a live process).
Create the repository
# Creates a private Docker image registry inside your GCP project.
# This is where GitHub Actions will push built images and Cloud Run will pull from.
# Result: visible at console.cloud.google.com/artifacts β the registry URL will be
# southamerica-east1-docker.pkg.dev/mycoolproject-prod/mycoolproject-repo/
gcloud artifacts repositories create mycoolproject-repo \
--repository-format=docker \
--location=southamerica-east1
This creates a repository at:
Images pushed here will be named:
Tags used in this guide:
latestβ always points to the most recent build<git-sha>β e.g.a3f9c12β unique tag per commit, used for precise rollbacks
Authenticate Docker to push images
Before pushing images from your local machine (first deploy only β GitHub Actions handles this automatically afterwards):
# Configures Docker on your local machine to use gcloud credentials when pushing
# to this registry. Run once per machine β not needed in GitHub Actions (handled
# by the workflow). Writes a credential helper to ~/.docker/config.json.
gcloud auth configure-docker southamerica-east1-docker.pkg.dev
This updates your local Docker config so it knows to use gcloud credentials when pushing to this registry.
π Navigation
- 01 β GCP Project Setup
- 02 β Artifact Registry (Current chapter)
- 03 β Cloud SQL (PostgreSQL Database)
- 04 β Secret Manager
- 05 β Cloud Storage (Media & Static Files)
- 06 β Dockerfile
- 07 β First Deploy
- 08 β Custom Domain & SSL
- 09 β Workload Identity Federation (Keyless GitHub Actions Auth)
- 10 β GitHub Actions CI/CD Pipeline
- 11 β Quick Reference
- 12 β Bonus: Custom Email (@domain.cl)