Sprint 04 Goals
| Goal ID | Objective | Deliverable |
|---|---|---|
| 1 | Understand Google Cloud Build | cloudbuild.yaml configuration files |
| 2 | Connect Cloud Build to GitHub | Build trigger on GitHub push |
| 3 | Automate Docker image builds | Dockerfile in application repo |
| 4 | Store Docker images in Artifact Registry | Images pushed to GCP registry |
Implementation Steps
1. Configure Google Cloud Build
We defined build steps in acloudbuild.yaml file to install dependencies, run tests, and build the Docker image:
Ensure the Cloud Build service account has
roles/artifactregistry.writer and roles/storage.admin for pushing images.2. Link Cloud Build to GitHub
We created a trigger so that any push to themain branch starts a build:
3. Automate Docker Image Builds
OurDockerfile defines how the application is containerized:
4. Publish to Artifact Registry
After building, Cloud Build pushes to Google Cloud Artifact Registry:Verify that your Artifact Registry repository is in the same region as your Cloud Build trigger to avoid latency issues.
Results and Next Steps
- All build steps in
cloudbuild.yamlexecute successfully. - GitHub pushes to
mainautomatically trigger Cloud Build. - Docker images build without manual intervention.
- Images are stored in Artifact Registry and available for deployment.