A Concourse task for building OCI images using the Cloud Native Buildpacks lifecycle
There is a task implementation for each of the Cloud Foundry CNB builders
- cloudfoundry/cnb:tiny -> bstick12/lifecycle-build-task:tiny
- cloudfoundry/cnb:bionic -> bstick12/lifecycle-build-task:bionic
- cloudfoundry/cnb:cflinuxfs3 -> bstick12/lifecycle-build-task:cflinuxfs3
You can see the implementations at lifecycle-build-task
You provide the task configuration as follows:
Point your task as the lifecycle-build-task
image resource
image_resource:
type: registry-image
source:
repository: bstick12/lifecycle-build-task
# Change this if you want to use a different CNB builder e.g. bionic, cflinuxfs3
tag: tiny
Next, any of the following parameters can be specified:
REPOSITORY
: Required. The name of the repository that you want to build e.g bstick12/built-with-cnb-lifecycle-taskTAG
: Optional. The tag value for the image. Defaults tolatest
REGISTRY_USERNAME
: Required. The username to authenticate with when pushingREGISTRY_PASSWORD
: Required. The password to use when authenticatingCACHE
: Optional: Directory that will be used by CNB to cache layers. Task must havecaches
with directory path specified.CONTEXT
: Required. The directory name of the input source you want to buildDEBUG
: Optional. Log debug output of the task. Defaults tofalse
BUILD_ENV
(default empty): a hash of environment variables that will be passed to the CNB builder
There are no required inputs - your task should just list each artifact it
needs as an input. Typically this is in close correlation with $CONTEXT
:
params:
CONTEXT: git-my-source
inputs:
- name: git-my-source
Your task should run the lifecycle-build-task
executable:
run:
path: lifecycle-build-task
The example below builds the goflake-server using the cloudfoundry/cnb:tiny
builder
resources:
- name: git-goflake-server
type: git
icon: "github-circle"
source:
uri: https://github.com/bstick12/goflake-server
jobs:
- name: build-goflake-server-tiny
plan:
- get: git-goflake-server
trigger: true
- task: goflake-server-lifecycle
config:
platform: linux
# The image resource configuration for the lifecycle-build task
image_resource:
type: registry-image
source:
repository: bstick12/lifecycle-build-task
# Change this if you want to use a different CNB builder e.g. bionic, cflinuxfs3
tag: tiny
params:
REPOSITORY: bstick12/goflake-server-lifecycle
TAG: tiny
CONTEXT: git-goflake-server
REGISTRY_USERNAME: ((docker-hub-username))
REGISTRY_PASSWORD: ((docker-hub-password))
CACHE: .cache
inputs:
- name: git-goflake-server
run:
path: lifecycle-build-task
caches:
- path: .cache
There is Makefile
provided to build and test the lifecycle-build-task
locally