LuisSala / solutions-build-multi-architecture-images-tutorial

Build multi-architecture container images on Google Cloud

Home Page:https://cloud.google.com/solutions/building-multi-architecture-container-images-iot-devices-tutorial

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building multi-architecture container images on Google Cloud

This repository contains the necessary scripts and descriptors to setup the infrastructure described in Building multi-architecture container images in Google Cloud reference guide:

  • Terraform templates that provision the necessary infrastructure on Google Cloud.
  • A Dockerfile to build a Docker image during the tutorial.

Dependencies

You need the following tools to follow the tutorial:

Setting environment variables

To provision the necessary infrastructure, you need to initialize and export the following environment variables:

  • TF_SERVICE_ACCOUNT_NAME: Google Cloud service account name that Terraform will use to provision resources.
  • TF_STATE_PROJECT: Google Cloud project ID that Terraform will use to store the state.
  • TF_STATE_BUCKET: Google Cloud Storage bucket that Terraform will use to save the state files.
  • GOOGLE_CLOUD_PROJECT: Google Cloud project ID that will contain the resources for the container image building pipeline.
  • GOOGLE_APPLICATION_CREDENTIALS: path to the default Google Cloud credentials.

Provisioning the environment

  1. Change your working directory to the root of this repository.
  2. Generate the Terraform backend configuration: ./generate-tf-backend.sh
  3. Change your working directory: cd terraform
  4. Inspect the changes that Terraform will apply: terraform plan
  5. Apply the changes: terraform apply

Triggering the pipeline

You can now trigger the container image building pipeline:

  1. Clone the Cloud Source Repository (CSR) that you provisioned with Terraform: gcloud source repos clone cross-build
  2. Copy the provided Dockerfile and the build-docker-image-trigger.yaml in the directory where you cloned the CSR repository.
  3. Commit the changes: git add .
  4. Push the changes to the remote CSR repository: git push

You can then open the Cloud Build page in the Google Cloud Console to inspect the results.

About

Build multi-architecture container images on Google Cloud

https://cloud.google.com/solutions/building-multi-architecture-container-images-iot-devices-tutorial

License:Apache License 2.0


Languages

Language:Shell 65.9%Language:HCL 31.9%Language:Dockerfile 2.3%