dockerversioning/

directory
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2022 License: Apache-2.0

README

Description

Versioning tools for Dockerfile source repos. Previously, these tools were in runtimes-common, but have been moved to click-to-deploy for further development.

  • dockerfiles generates versionsed Dockerfiles from a common template.
  • cloudbuild generates a configuration file to build these Dockerfiles using Google Container Builder.

Installation

git clone https://github.com/GoogleCloudPlatform/click-to-deploy.git
cd click-to-deploy/tools
  • Build:
bazel run //:gazelle
bazel build dockerversioning/scripts/dockerfiles:dockerfiles
bazel build dockerversioning/scripts/cloudbuild:cloudbuild
  • Set the path to the built scripts:
BAZEL_ARCH=linux_amd64_stripped
export PATH=$PATH:$PWD/bazel-bin/dockerversioning/scripts/dockerfiles/${BAZEL_ARCH}/
export PATH=$PATH:$PWD/bazel-bin/dockerversioning/scripts/cloudbuild/${BAZEL_ARCH}/

Create versions.yaml

At root of the Dockerfile source repo, add a file called versions.yaml. Follow the format defined in versions.go. See an example on github.

Primary folders in the Dockerfile source repo:

  • templates contains Dockerfile.template, which is a Go template for generating Dockerfiles.
  • tests contains any tests that should be included in the generated cloud build configuration.
  • Version folders as defined in versions.yaml. The Dockerfiles are generated into these folders. The folders should also contain all supporting files for each version, for example docker-entrypoint.sh files.

Usage of dockerfiles command

cd path/to/dockerfile/repo
dockerfiles

Usage of cloudbuild command

cd path/to/dockerfile/repo
cloudbuild > cloudbuild.yaml

You can use the generated cloudbuild.yaml file as followed:

gcloud container builds submit --config=cloudbuild.yaml .

Directories

Path Synopsis
scripts
cloudbuild
Command line tool for generating a Cloud Build yaml file based on versions.yaml.
Command line tool for generating a Cloud Build yaml file based on versions.yaml.
dockerfiles
Command line tool for updating Dockerfiles based on versions.yaml.
Command line tool for updating Dockerfiles based on versions.yaml.
Library for parsing versions.yaml file.
Library for parsing versions.yaml file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL