Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps.
This article describes how to build a container image by using Paketo Buildpacks.
Azure Spring Apps service supports building an image from source code without using Dockerfiles. It isn't limited to Java applications but extends to other programming languages and even static web content. In the Standard plan, the service uses open-source Paketo Buildpacks. If there's no online service for using Paketo, you can switch to local Paketo Buildpacks to build images. Then deploy them to Azure Container Registry or other Docker registries.
This article shows you how to create a builder with a TOML file, and then build your source code or artifact file with the builder. For more information, see builder.toml. To understand the build image, run image, and stack, see What are base images.
Prerequisites
Standard plan
The Azure Spring Apps Standard plan comes with a built-in builder, which you can't customize. If you use the Standard plan, you need to create a TOML file called standard-builder.toml with the following content. With this file, you can create a builder equivalent to the one available in the Azure Spring Apps Standard plan.
# filename: standard-builder.toml
[[buildpacks]]
uri = "docker://docker.io/paketobuildpacks/java-azure:12.0.0"
id = "paketo-buildpacks/java-azure"
[[buildpacks]]
uri = "docker://docker.io/paketobuildpacks/java-native-image:9.8.0"
id = "paketo-buildpacks/java-native-image"
[[buildpacks]]
uri = "docker://docker.io/paketobuildpacks/dotnet-core:0.48.3"
id = "paketo-buildpacks/dotnet-core"
[[order]]
[[order.group]]
id = "paketo-buildpacks/java-azure"
[[order]]
[[order.group]]
id = "paketo-buildpacks/java-native-image"
[[order]]
[[order.group]]
id = "paketo-buildpacks/dotnet-core"
[build]
image = "paketobuildpacks/build-jammy-base:0.1.129"
[run]
[[run.images]]
image = "paketobuildpacks/run-jammy-base:0.1.129"
To create a builder with this TOML file, use the following command:
pack builder create <builder-name> --config ./standard-builder.toml
You can inspect the builder by using the following command:
pack builder inspect <builder-name>
To build your Java source code or .NET source code to a container image with this builder, use the following command:
pack build <image-name> \
--path <path-to-source-root> \
--builder <builder-name>
To build an artifact - such as a JAR or WAR file - to a container image with the builder, use the following command:
pack build <image-name> \
--path <path-to-artifact> \
--builder <builder-name>
Customization
Buildpacks provide a way to customize various configurations. The following examples show common scenarios for building your container image with specific requirements:
- To customize the JDK for Java source code, see paketo-buildpacks/microsoft-openjdk.
- To customize Tomcat for WARs, see paketo-buildpacks/apache-tomcat.
- To add CA certificates to the system trust store at build and runtime, see paketo-buildpacks/ca-certificates.
For more information on properties and configurations, see How to Build Java Apps with Paketo Buildpacks and Java Buildpack Reference.