Skip to main content
Version: 1.6.0

Custom a custom Builder image

The default builder image used by Epinio (paketobuildpacks/builder:full) may not work for every application. This could happen if a non-supported programming language is used, or when the application needs to be staged in a very specific way. This page explains how a custom builder image can be built that includes one or more buildpacks. We don't explain how to create a custom buildpack in this guide (upstream docs or with packit).

Background​

If you are familiar with the pack cli you know that it's possible to add a buildpack to a project using project.toml:

[project]
id = "sample"
version = "0.1"

[build]

[[build.buildpacks]]
id = "paketo-community/python"
version = "0.4.2"

Pack can then build the image for the application by running pack build test/pip -B paketobuildpacks/builder:full.

However, since Epinio is not using pack but the lifecycle directly (link 1, link 2), using project.toml is not possible:

Solution: Using a Custom Builder​

We can create a custom builder that supports Python and tell Epinio to use that for staging.

git clone git@github.com:paketo-buildpacks/full-builder.git

patch -p1 <<EOF
diff --git a/builder.toml b/builder.toml
index f3a35fd..b228671 100644
--- a/builder.toml
+++ b/builder.toml
@@ -32,6 +32,10 @@ description = "Ubuntu bionic base image with buildpacks for Java, .NET Core, Nod
uri = "docker://gcr.io/paketo-buildpacks/php:0.5.0"
version = "0.5.0"

+[[buildpacks]]
+ uri = "docker://gcr.io/paketo-community/python:0.4.2"
+ version = "0.4.2"
+
[[buildpacks]]
uri = "docker://gcr.io/paketo-buildpacks/procfile:4.2.2"
version = "4.2.2"
@@ -97,6 +101,12 @@ description = "Ubuntu bionic base image with buildpacks for Java, .NET Core, Nod
id = "paketo-buildpacks/java"
version = "5.9.1"

+[[order]]
+
+ [[order.group]]
+ id = "paketo-community/python"
+ version = "0.4.2"
+
[[order]]

[[order.group]]
EOF

pack builder create myorg/epicustombuilder --config builder.toml

Make the image epicustombuilder:local available to your cluster by pushing it to a container registry. You can then push your application to Epinio and use your image with the --builder-image flag:

epinio push -n myapp -p app_directory --builder-image myorg/epicustombuilder:latest

Reference​