Skip to content

Concourse Resource that uses Pack CLI to build container images

Notifications You must be signed in to change notification settings

bstick12/pack-concourse-resource

Repository files navigation

Pack CLI Concourse Resource

You should probably look at using the lifecycle-build task instead of this resource.


A proof of concept concourse resource that builds OCI images using the pack-cli

Uses Docker in Docker so must be run a privileged.

It borrows heavily from the docker-image-resource

It utilizes the in and check behaviours from the registry-image-resource

Currently will only work with buildpacks that are build using pack > v0.0.9

Source Configuration

  • repository: Required. The name of the repository that you want to build e.g bstick12/built-with-pack
  • tag: Optional. The tag value for the image. Defaults to latest
  • username: Required. The username to authenticate with when pushing
  • password: Required. The password to use when authenticating

Behaviour

check: Discover new digests

See registry-image-resource/check

in: Fetch the image's rootfs and metadata

See registry-image-resource/in

out: Build an OCI image using the pack CLI and push to a repository

Parameters

  • build: Required. The source code to build in to the OCI image.
  • builder: Optional. The builder to use to build the OCI image.
  • tag: Optional. Name of tag. Defaults to latest. Overridden by tag_file.
  • tag_file: Optional. The value should be a path to a file containing the name of the tag.
  • tag_prefix: Optional. If specified, the tag read from the file will be prepended with this string. This is useful for adding v in front of version numbers.

Example

---
resources:
- name: git-resource
  type: git
  source: # ...

- name: pack-built-image
  type: pack-image-resource
  source:
    repository: ((image-name))
    email: ((docker-hub-email))
    username: ((docker-hub-username))
    password: ((docker-hub-password))

resource_types:
- name: pack-image-resource
  type: docker-image
  privileged: true
  source:
    repository: bstick12/pack-concourse-resource
    version: latest

jobs:
- name: build-source-using-pack-image-resource
  plan:
  - get: git-resource
    trigger: true
  - put: pack-built-image
    params:
      build: pack-built-image
      builder: ((pack-builder-image))