containerbuilding / cbi

Container Builder Interface for Kubernetes with support for several backends (Docker, BuildKit, Buildah, kaniko, img, Google Cloud Container Builder, Azure Container Registry Build, OpenShift Source-to-Image...)
Apache License 2.0
243 stars 18 forks source link

new plugin: kaniko #35

Closed AkihiroSuda closed 6 years ago

AkihiroSuda commented 6 years ago

Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp

ref: https://github.com/GoogleContainerTools/kaniko/issues/63 cc @priyawadhwa @dlorenc @r2d4

Tested with Amazon ECR. Of course it should work with GCR as well, although kubectl create secret docker-registry-style secret is needed.

Installation

$ ./hack/build/build-push-apply.sh registry.example.com/cbi test-$(date +%s)

Example job

apiVersion: v1
kind: ConfigMap
metadata:
  name: foo-configmap
data:
  Dockerfile: |-
    FROM busybox
    ADD hello /
    RUN cat /hello
  hello: "hello, kaniko world"

---

apiVersion: cbi.containerbuilding.github.io/v1alpha1
kind: BuildJob
metadata:
  name: foo
spec:
  registry:
    target: registry.example.com/foo:bar
    push: true
    secretRefs:
      - name: registry-secret
  language:
    kind: Dockerfile
  context:
    kind: ConfigMap
    configMapRef:
      name: foo-configmap
  pluginSelector: plugin.name=kaniko