📚 / Documentation / Tools / kbld


Overview

kbld helps you build, push and resolve Docker images.

Installation

To enable this tool, add this to your vars.yml:

---
tools:
  - docker
  - kbld

Usage

kbld relies on docker. Consider reading the documentation for the Docker tool before continuing.

Sample pipeline

vars.yml:

---
tools:
  - docker
  - kbld

packages:
  - name: build-push-docker-image
    kind: bundle
  - name: echo-app
    kind: application

environment:
  - DOCKER_USERNAME
  - DOCKER_PASSWORD

templates/echo-app-deployment.yml:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kbld-test1
spec:
  selector:
    matchLabels:
      app: kbld-test1
  template:
    metadata:
      labels:
        app: kbld-test1
    spec:
      containers:
        - name: my-app
          image: simple-app #! <-- unresolved image ref
---
apiVersion: kbld.k14s.io/v1alpha1
kind: Config
sources:
  - image: simple-app
    newImage: docker.io/example/simple-app
    path: .
    docker:
      build:
        target: "example/simple-app"
        pull: yes
        noCache: yes
        file: containers/demo.dockerfile

containers/demo.dockerfile:

FROM alpine:latest

CMD [ "/bin/sh", "-c", "echo 'hello world'"]

bundles/build-push-docker-image/10-login.sh:

#!/bin/bash

set -eux

echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin

bundles/build-push-docker-image/20-build-push.sh:

#!/bin/bash

set -eux

kbld -f ./templates/echo-app-deployment.yml > ./applications/echo-app/manifest.yml

applications/echo-app/README.md:

# Echo Application

This application is generated by the bundle `build-push-docker-image`.

What’s next?

Read more about kbld on their documentation.