Alpaquita Linux: Building applications with Cloud Native Buildpacks
1. Introduction
BellSoft provides Cloud Native Buildpacks images for Paketo Buildpacks® based on BellSoft Hardened Images that contain six language runtimes: Java (the latest minor versions of Liberica JDK Lite), native images with Liberica NIK (GraalVM-based tool), Node.js, Python, Go, and Ruby. The builder supports both x86-64 and ARM64 architectures, and it is optimized for Alpaquita Linux.
Alpaquita Linux is a full-featured operating system shipped in two libc variants based on two different libc implementations, namely glibc and musl. Using Alpaquita Linux (musl) as a target image helps you create lightweight Docker images.
Cloud Native Buildpacks
Cloud Native Buildpacks (CNBs) transform your application source code into container images that can run on any cloud.
Language runtimes
Liberica JDK Lite
Liberica JDK Lite is a JDK optimized for cloud instances with a minimal footprint. It is a full-fledged, Java SE-compliant runtime but much smaller than any standard Java distribution. Liberica JDK Lite has a higher compression ratio for modules than a classic JDK, thus reducing static footprint. For more information, see Liberica JDK Lite in the Choosing Liberica JDK flavor document.
Liberica NIK
Liberica Native Image Kit is a utility capable of converting your JVM-based application into a fully compiled native executable ahead-of-time under the closed-world assumption with an almost instant startup time. It optimizes resource consumption, minimizes the static footprint, and works on various platforms, including lightweight musl-based Alpaquita Linux.
Node.js
Node.js is an open-source and cross-platform runtime environment designed to execute JavaScript outside of a web browser. This architecture enables the use of JavaScript for developing server-side applications, command-line interfaces, and various backend network services.
Python
Python is a versatile, high-level object-oriented programming language known for its readability and simplicity. It is widely used for web development, data science, and task automation.
Go
Go is a high-level, general-purpose programming language that is statically typed and compiled. It is known for the simplicity of its syntax and the efficiency of development that it enables through the inclusion of a large standard library supplying many needs for common projects.
Ruby
Ruby is an open-source general-purpose programming language designed with an emphasis on simplicity, natural syntax, and productivity. Designed to make programming intuitive, it treats everything as an object.
2. Image flavors
When building images from BellSoft buildpacks, you can choose one of the latest JDK releases of 8, 11, 17 (default), 21, and 25 JDK versions; 22 and 23 NIK versions; Alpaquita Linux based on glibc and musl libraries. You can build runnable images with applications written in Python, Node.js, Go, and Ruby.
|
Note:
| BellSoft buildpacks support Python version 3.14 and Node.js version 24. |
For the latest BellSoft product release versions, see the following links:
Choosing libc library
If the size of the resulting image is important and the final application does not have native components that require glibc, then choose musl. If you need higher performance with a slight increase in size of the final image, it makes sense to consider using the glibc library. In addition, there might be other considerations when choosing C runtime, such as licensing, because glibc is licensed under the LGPLv2.1 (GNU Lesser General Public License), while musl uses the highly permissive MIT License.
3. Building applications with BellSoft Hardened Images
The following are just a few examples for building applications using the bellsoft builder.
|
Note:
| A builder includes the buildpacks that will be used as well as the environment for building your app. For more information about getting started with buildpacks, see Build your very first application with buildpacks. |
Building a Java application
To containerize a Java application with the BellSoft Hardened Images and the default JDK version, run one of the following commands within the root of your project. Make sure you choose the bellsoft builder and specify the target C library.
-
Building a Java application with Alpaquita Linux (glibc)
pack build demo-app --builder bellsoft/buildpacks.builder:glibc --path . -
Building a Java application with Alpaquita Linux (musl)
pack build demo-app --builder bellsoft/buildpacks.builder:musl --path .
Where bellsoft/buildpacks.builder:<glibc/musl> is the BellSoft builder producing an Alpaquita Linux image with the specified C library. You can also specify BellSoft builder as the default one as follows:
pack config default-builder bellsoft/buildpacks.builder:musl
If you want to install a specific JVM feature version, use the BP_JVM_VERSION environment variable that accepts the following JDK version values: 8, 11, 17, 21, 25 (default is 17). For example:
pack build demo-app --builder bellsoft/buildpacks.builder:glibc --path . -env BP_JVM_VERSION=21
To inspect the resulting image, check the stack, buildpacks participated in the build, etc. Run the following command:
pack inspect demo-app
You can also check the Linux distro inside your Docker image as follows:
docker run --rm -it --entrypoint /bin/cat demo-app /etc/os-release
Then you can check the image size as follows:
docker image ls demo-app
To run the application, use the following Docker command:
docker run --rm -it demo-app
Configuration options
The following table lists pack builder configuration options for BellSoft Liberica JDK Lite and Native Image Kit Cloud Native Buildpacks ver. 1.1.0.
| Variable | Default value | Description |
|---|---|---|
Build configuration options | ||
$BP_JVM_JLINK_ARGS |
| Configures custom jlink arguments ( |
$BP_JVM_JLINK_ENABLED |
| Enables the jlink tool to generate custom JRE. |
$BP_JVM_TYPE | JRE | Specifies the JVM type - JDK or JRE. |
$BP_JVM_VERSION | 17 | Specifies a Java version. |
Launch configuration options | ||
$BPL_DEBUG_ENABLED | false | Enables Java remote debugging support. |
$BPL_DEBUG_PORT | 8000 | Specifies the remote debugging port. |
$BPL_DEBUG_SUSPEND | false | Specifies whether to suspend execution until a debugger has attached. |
$BPL_HEAP_DUMP_PATH | N/A | Specifies the path to write heap dumps on error. |
$BPL_JAVA_NMT_ENABLED | true | Enables Java Native Memory Tracking (NMT). |
$BPL_JAVA_NMT_LEVEL | summary | Configures the level of NMT, |
$BPL_JFR_ARGS | N/A | Configures custom Java Flight Recording (JFR) arguments. |
$BPL_JFR_ENABLED | false | Enables Java Flight Recorder (JFR). |
$BPL_JMX_ENABLED | false | Enables Java Management Extensions (JMX). |
$BPL_JMX_PORT | 5000 | Specifies the JMX port. |
$BPL_JVM_HEAD_ROOM | 0 | Configures the headroom in memory calculation. |
$BPL_JVM_LOADED_CLASS_COUNT | 35% of classes | Sets the number of loaded classes in memory calculation. |
$BPL_JVM_THREAD_COUNT | 250 | Sets the number of threads in memory calculation. |
$JAVA_TOOL_OPTIONS | N/A | Specifies the JVM launch flags. |
Optimizing image with JLink
The JRE inside the resulting image can be optimized in size by using the jlink tool. To enable jlink, set the environment variable BP_JVM_JLINK_ENABLED to true (default is false). In this case, jlink generates a custom JRE with the following default options: --no-man-pages, --no-header-files, --strip-debug, --compress=1. To change the options, use BP_JVM_JLINK_ARGS environment variable. Check the jlink
documentation for further information.
For example, the following command creates a new application image on Alpaquita Linux with a custom JRE 21:
pack build demo-app --builder bellsoft/buildpacks.builder:musl --path . -env BP_JVM_VERSION=21 -env BP_JVM_JLINK_ENABLED=true
The resulting image is usually smaller than the one with the default JRE.
Building a containerized native application with Liberica NIK
To build a native image application using Liberica NIK, set the BP_NATIVE_IMAGE environment variable to true as in the following example:
pack build demo-native-app --builder bellsoft/buildpacks.builder:musl --path . --env BP_NATIVE_IMAGE=true --env BP_JVM_VERSION=21
You can check the size of the resulting image as follows:
docker image ls demo-native-app
To run the application, use the following Docker command:
docker run --rm -it demo-native-app
For more information about building Java applications and available options, see How to Build Java Apps with Paketo Buildpacks.
Building a Node.js application
|
Note:
| BellSoft buildpacks support Node.js version 24. |
To build a Node.js application locally with the bellsoft builder, run the following command in your Node.js project folder. Choose the bellsoft builder and specify the target C library.
pack build nodejs-app --builder bellsoft/buildpacks.builder:musl --path .
Where bellsoft/buildpacks.builder is the BellSoft builder producing an image. You can also specify BellSoft builder as the default one as follows:
pack config default-builder bellsoft/buildpacks.builder:musl
For more information about building Node.js applications and available options, see How to Build Node.js Apps with Paketo Buildpacks.
Building a Go application
To quickly build a Go application into a runnable image on your local machine with the bellsoft builder, run the following command in your Go project folder. Choose the bellsoft builder and specify the target C library.
pack build go-app --builder bellsoft/buildpacks.builder:musl --path .
Where bellsoft/buildpacks.builder is the BellSoft builder producing an image. You can also specify BellSoft builder as the default one as follows:
pack config default-builder bellsoft/buildpacks.builder:musl
For more information about building Go applications and available options, see How to Build Go Apps with Paketo Buildpacks.
Building a Python application
|
Note:
| BellSoft buildpacks support Python version 3.14. |
To build a Python application locally with the bellsoft builder, run the following command in your Python project folder. Choose the bellsoft builder and specify the target C library.
pack build python-app --builder bellsoft/buildpacks.builder:musl --path .
Where bellsoft/buildpacks.builder is the BellSoft builder producing an image. You can also specify BellSoft builder as the default one as follows:
pack config default-builder bellsoft/buildpacks.builder:musl
For more information about building Python applications and available options, see How to Build Python Apps with Paketo Buildpacks.
Building a Ruby application
To build a Ruby application locally with the bellsoft builder, run the following command in your Ruby project folder. Choose the bellsoft builder and specify the target C library.
pack build ruby-app --builder bellsoft/buildpacks.builder:musl --path .
Where bellsoft/buildpacks.builder is the BellSoft builder producing an image. You can also specify BellSoft builder as the default one as follows:
pack config default-builder bellsoft/buildpacks.builder:musl
For more information about building Ruby applications and available options, see How to Build Ruby Apps with Paketo Buildpacks.