apiVersion: batch/v1
kind: Job
metadata:
  name: builder
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
      - image: estesp/buildexample:1.0
        command: ["buildctl"]
        args: ["--addr=tcp://buildkitd:1234", "build",
             "--progress=plain",
             "--frontend=dockerfile.v0",
             "--frontend-opt", "filename=Dockerfile.example",
             "--local", "context=.", "--local", "dockerfile=.",
             "--exporter=image", "--exporter-opt", "name=estesp/mybkimg:latest", "--exporter-opt", "push=true"]
        name: build-example
        env:
        - name: DOCKER_CONFIG
          value: "/etc/docker"
        volumeMounts:
        - name: configjson
          mountPath: "/etc/docker"
          readOnly: true
      volumes:
      - name: configjson
        secret:
          secretName: dockerconfig
  backoffLimit: 2
