1
0
Fork 0
mirror of https://github.com/imjasonh/build-templates synced 2026-07-06 22:52:17 +00:00
build-templates/bazel
2018-05-11 12:41:08 -04:00
..
bazel.yaml Add Bazel template (#4) 2018-05-07 14:50:04 -04:00
README.md Fix examples (#10) 2018-05-11 12:41:08 -04:00

Bazel

This build template builds source into a container image using the Bazel build tool, and Bazel's container image support.

This assumes the source repo in question is using the container_push rule to build and push a container image. For example:

container_push(
  name = "push",
  format = "Docker", # Or "OCI"
  image = ":image",
  registry = "gcr.io",
  repository = "my-project/my-app",
  stamp = True,
)

This target instructs Bazel to build and push a container image containing the application defined by the :image target, based on a suitable base image.

The rules_docker repo defines build rules to construct images for a variety of popular programming languages, like Python, Java, Go and many more.

Parameters

  • TARGET: The Bazel container_push target to run.

Usage

apiVersion: build.dev/v1alpha1
kind: Build
metadata:
  name: bazel-build
spec:
  source:
    git:
      url: https://github.com/my-user/my-repo
      branch: master
  template:
    name: bazel
    arguments:
    - name: TARGET
      value: //path/to/build:target