{
  "name": "docker-build-push",
  "title": "Build and push a container image",
  "category": "CI/CD",
  "tags": [
    "buildkit",
    "ci-cd"
  ],
  "version": "2.0.0",
  "date": "2026-08-06",
  "notes": "Replace Kaniko with rootless BuildKit. Google archived kaniko, so its 112 fixable CRITICAL/HIGH (5 CRITICAL) could never come down; BuildKit v0.32.2 measures 64, none CRITICAL, and ships often enough for that to move. Breaking on three counts, hence the major. A context is now a directory or a git/HTTP URL, so kaniko's s3://, gs:// and dir:// contexts are gone and its git:// prefix now means the git wire protocol rather than \"clone over HTTPS\"; a git subdirectory rides in the URL fragment as `#ref:subdir` where kaniko took a separate --context-sub-path. The container needs Unconfined seccomp and AppArmor to unshare a user namespace, which kaniko did not, so it will not admit into a namespace enforcing PodSecurity `restricted`. New `push` parameter, default \"true\", standing in for kaniko's --no-push.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yaml",
  "entrypoint": "build",
  "parameters": [
    {
      "name": "context",
      "title": "Build context",
      "description": "A directory BuildKit can read, or a git/HTTP URL it can fetch. A git URL carries its branch and subdirectory as a #ref:subdir fragment.",
      "type": "string",
      "required": true,
      "example": "/work"
    },
    {
      "name": "destination",
      "title": "Destination image",
      "description": "Fully-qualified destination image reference to push (registry/repo:tag).",
      "type": "string",
      "required": true,
      "example": "ghcr.io/org/app:1.2.3"
    },
    {
      "name": "docker-config-secret-key",
      "title": "Docker config secret key",
      "description": "Key within the Secret that holds the Docker config.json.",
      "type": "string",
      "required": false,
      "default": ".dockerconfigjson"
    },
    {
      "name": "docker-config-secret-name",
      "title": "Docker config secret name",
      "description": "Name of the Kubernetes Secret holding the registry Docker config.json.",
      "type": "string",
      "required": false,
      "default": "docker-config"
    },
    {
      "name": "dockerfile",
      "title": "Dockerfile",
      "description": "Path to the Dockerfile, relative to the context root.",
      "type": "string",
      "required": false,
      "default": "Dockerfile"
    },
    {
      "name": "push",
      "title": "Push",
      "description": "Set to false to build the image and keep it in the builder without pushing it anywhere.",
      "type": "string",
      "required": false,
      "default": "true",
      "enum": [
        "true",
        "false"
      ]
    }
  ],
  "images": [
    {
      "ref": "moby/buildkit@sha256:f68752a5a94acfcdad2d07867b7075601a421638e17fc5f28efc1c814d0c4f89",
      "repository": "moby/buildkit",
      "tag": "v0.34.1-rootless",
      "digest": "sha256:f68752a5a94acfcdad2d07867b7075601a421638e17fc5f28efc1c814d0c4f89"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/docker-build-push/2.0.0/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: docker-build-push\n  labels:\n    dagweave.io/catalog-item: docker-build-push\n  annotations:\n    # The catalog semver this manifest was authored at. The dagweave app records\n    # (catalog-item-id, semver) -\u003e content-hash -\u003e base-vN when it mints the tenant\n    # cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.\n    dagweave.io/catalog-version: \"2.0.0\"\n    dagweave.io/catalog-category: \"CI/CD\"\nspec:\n  entrypoint: build\n  # Registry credentials are a Docker config.json mounted at $DOCKER_CONFIG, which is\n  # where buildctl looks for auth. The Secret is a standard kubernetes.io/dockerconfigjson\n  # (or any Secret whose key holds a Docker config).\n  volumes:\n    - name: docker-config\n      secret:\n        secretName: \"{{inputs.parameters.docker-config-secret-name}}\"\n        items:\n          - key: \"{{inputs.parameters.docker-config-secret-key}}\"\n            path: config.json\n  templates:\n    - name: build\n      inputs:\n        parameters:\n          # A directory in the container, or a git/HTTP URL. A git URL carries its branch\n          # and subdirectory as a `#ref:subdir` fragment rather than in separate flags.\n          - name: context\n          # Path to the Dockerfile, relative to the context root.\n          - name: dockerfile\n            default: Dockerfile\n          # Fully-qualified destination image reference to push (registry/repo:tag).\n          - name: destination\n          # \"false\" builds the image and keeps it in the builder, pushing nothing.\n          - name: push\n            default: \"true\"\n          # Name of the Kubernetes Secret holding the registry Docker config.json.\n          # Defaults let a user leave them blank in the Inspector.\n          - name: docker-config-secret-name\n            default: docker-config\n          - name: docker-config-secret-key\n            default: .dockerconfigjson\n      container:\n        # Pinned by digest per the catalog convention: an image rebuild can never\n        # silently change the behaviour of an already-released item version.\n        # moby/buildkit:v0.34.1-rootless\n        image: moby/buildkit@sha256:f68752a5a94acfcdad2d07867b7075601a421638e17fc5f28efc1c814d0c4f89\n        command: [sh, -c]\n        # Values arrive as env vars (below) and are never interpolated from Argo into the\n        # shell, so a context or tag holding quotes or metacharacters is safe. The if is\n        # because buildkit names a local context with --local and a remote one with --opt.\n        args:\n          - |\n            set -eu\n            if [ -d \"$CONTEXT\" ]; then\n              set -- --local \"context=$CONTEXT\" --local \"dockerfile=$CONTEXT\"\n            else\n              set -- --opt \"context=$CONTEXT\"\n            fi\n            buildctl-daemonless.sh build \\\n              --frontend dockerfile.v0 \\\n              --opt \"filename=$DOCKERFILE\" \\\n              \"$@\" \\\n              --output \"type=image,name=$DESTINATION,push=$PUSH\"\n        env:\n          - name: CONTEXT\n            value: \"{{inputs.parameters.context}}\"\n          - name: DOCKERFILE\n            value: \"{{inputs.parameters.dockerfile}}\"\n          - name: DESTINATION\n            value: \"{{inputs.parameters.destination}}\"\n          - name: PUSH\n            value: \"{{inputs.parameters.push}}\"\n          # buildctl reads registry auth from $DOCKER_CONFIG/config.json.\n          - name: DOCKER_CONFIG\n            value: /docker-config\n          # Rootless buildkitd cannot nest a second sandbox inside an unprivileged pod.\n          - name: BUILDKITD_FLAGS\n            value: --oci-worker-no-process-sandbox\n          # buildctl-daemonless.sh starts buildkitd in this pod and polls for it,\n          # sleeping (100 + try*20)ms and giving up at try \u003e max with exit 1. The\n          # image defaults max to 10, which is eleven sleeps and 2.2 SECONDS in\n          # total. A quiet cluster beats that; a busy one does not, which is why\n          # this item passed 6/6 alone and failed intermittently inside full runs.\n          # 60 is 61 sleeps and about 43 seconds. A daemon that has genuinely not\n          # started still fails, 40 seconds later than it used to.\n          - name: BUILDCTL_CONNECT_RETRIES_MAX\n            value: \"60\"\n        # Rootless buildkit unshares a user namespace, which the default seccomp and\n        # AppArmor profiles block. Nothing privileged and no added capability, but\n        # Unconfined is more than kaniko needed and PodSecurity `restricted` forbids it.\n        securityContext:\n          runAsUser: 1000\n          runAsGroup: 1000\n          seccompProfile:\n            type: Unconfined\n          appArmorProfile:\n            type: Unconfined\n        volumeMounts:\n          - name: docker-config\n            mountPath: /docker-config\n",
  "templateSha256": "e785d25299e9823d5b79e33df5daaab16993dbd4e83d90d19376387cca735160",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/docker-build-push",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
