mirror of
https://github.com/imjasonh/build-templates
synced 2026-07-06 22:52:17 +00:00
| .. | ||
| bazel.yaml | ||
| README.md | ||
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_pushtarget 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