What Is a Buildpack?

At a previous company, we containerized applications by writing a Dockerfile, building the source code, and then building and pushing the image with kaniko.

At my current company, we use buildpacks to simplify CI/CD.
I want to take this opportunity to briefly explain what a buildpack is.

The Spring Boot documentation explains it in detail, as shown below.
Post image 1

It says that buildpacks can create images without a Dockerfile.

With the Maven plugin, you can define the bootBuildImage task in pom.xml; with Gradle, you can define it in build.gradle and use it in your CI/CD pipeline.

Post image 2

Following the example, you can specify the bootBuildImage task and build the image with the command below.

Code
./gradelw bootBuildImage

As the official documentation also explains, you can change the JVM options as follows!

Code
tasks.named<BootBuildImage>("bootBuildImage") {
	environment.set(mapOf(
		"BPE_DELIM_JAVA_TOOL_OPTIONS" to " ",
		"BPE_APPEND_JAVA_TOOL_OPTIONS" to "-XX:+HeapDumpOnOutOfMemoryError"
	))
}

Using it at work has simplified the CI/CD pipeline itself and made it easier to read. But it seems I cannot perform the image size optimizations I would do in a Dockerfile, such as splitting stages and reducing the number of layers.

Does anyone know a way to reduce image size while still using buildpacks?

Diagram

100%

Drag to pan; pinch or use the wheel to zoom. Keyboard: arrow keys pan, + − zoom, 0 fits, Esc closes. The same content is in “Read the diagram as text” below the figure.