Skip to main content
Version: Next 🚧

Creating a custom builder

The default builder image used by Epinio (paketobuildpacks/builder:full) may not work for every application. It could happen if using an unsupported programming language, or when the application needs staging in a particular way. This page explains how to build a custom builder image including one or more buildpacks. This guide doesn't explain how to create a custom buildpack. For information on that, use the (Buildpack documentation or the Paketo documentation).

Background

Using the pack CLI you can add a buildpack to a project using a project.toml configuration file:

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

[build]

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

You can then build the image for the application by running:

pack build test/pip -B paketobuildpacks/builder:full

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

Solution: Using a custom builder

You can create a custom builder that supports Python and then 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

More examples

You can find a more complete example on how to build and deploy a custom builder at Deploy Gitea with a custom builder image.

Reference