back to all blogsSee all blog posts

Introducing the Paketo Liberty Buildpack

image of author image of author
Kevin Ortega and Hank Ibell on Apr 1, 2022

Paketo buildpacks transform your application source code into container images and easily keep them updated.

What is a buildpack?

A buildpack is a set of executables that inspects your application source code and creates a plan to build your application.

Paketo buildpacks implement the Cloud Native Computing Foundation buildpack specification to provide toolkits and workflows for building reproducible container images from source code.

The Paketo Liberty buildpack provides the Open Liberty runtime to a workflow that produces an Open Container Initiative (OCI) image that can run just about anywhere.

Why use the Paketo Liberty buildpack?

  • You can build your application without creating a Dockerfile!

  • Advanced Caching: Paketo buildpacks use built-in caching to improve performance so you can quickly rebuild your application by updating only the layers that have changed.

  • Bill-of-Materials: a built-in software bill of materials (SBOM) support provides insights into the contents of the application image.

  • Minimal Application Image: images contain only what is necessary.

  • Reproducibility: reproduce the same application image digest by re-running the build.

  • Auto-detection: images are built directly from application source.

  • Rebasing: instantly update base images without rebuilding your source code by patching the OS layer of your image.

What do you need?

Let’s get started!

The following examples use the Open Liberty starter application as the application source. Download the Open Liberty starter application:

git clone https://github.com/openliberty/guide-getting-started.git
cd guide-getting-started/finish

Set a default builder:

pack config default-builder gcr.io/paketo-buildpacks/builder:base

Build the application on Liberty with Jakarta EE Platform 9.1 features and IBM Semeru OpenJ9:

 pack build --env BP_JAVA_APP_SERVER=liberty --env BP_LIBERTY_PROFILE=jakartaee9 \
  --buildpack paketo-buildpacks/eclipse-openj9 --buildpack paketo-buildpacks/java myapp

Your application is now transformed into an OCI image!

Now what?

With your OCI image, you can run your application locally with the docker run command.

Now run your application:

docker run --rm -p 9080:9080 myapp

or deploy your application to any Kubernetes-based platform, such as Red Hat OpenShift, by using an Open Liberty operator

Build your app from an on-prem Open Liberty installation

You can build from an on-prem Open Liberty installation by using a packaged Liberty server. Run the following command to package your server.

bin/server package defaultServer --include=usr

You can then supply the packaged server to the build by using the --path argument:

pack build --path <packaged-server-zip-path> \
 --buildpack paketo-buildpacks/eclipse-openj9 \
 --buildpack paketo-buildpacks/java myapp

Alternatively, you can build from a Liberty server installation by changing your working directory to the installation root that contains the wlp directory and running the following command:

pack build \
 --buildpack paketo-buildpacks/eclipse-openj9 \
 --buildpack paketo-buildpacks/java myapp

Learn more:

Tags