Builds Ubuntu ROCK image for your application using Gradle or Maven. The plugin requires rockcraft installed.
The build plugins generate rockcraft.yaml
in the output directory and build a rock image for your application.
The plugins provide tasks/goals to build and deploy rock image.
The parts generated are prefixed with a build system name, e.g. gradle
or maven
.
The plugins create the following parts in rockcraft.yaml
:
<build-system>/rockcraft/runtime
: e.g.maven/rockcraft/runtime
orgradle/rockcraft/runtime
. This part generates a Java runtime image for the application usingjlink
. The part finds all jar files in the target image/jars
directory and generates a runtime image deployed in the/usr/jvm/java-<version>-openjdk-<arch>/
directory. It creates a symlink tojava
executable in/usr/bin/java
.<build-system>/rockcraft/deps
: deploys openjdk runtime dependencies.<build-system>/rockcraft/dump
: copies build artifact into target image's/jars
directory.
The rock is built using the base bare
image.
The generated rockraft.yaml
can be overridden by providing rockcraftYaml
configuration property to the plugin. The plugin merges the generated rockcraft.yaml
and the override one.
Name | Description |
---|---|
buildPackage | OpenJDK Ubuntu package used to create a runtime image, e.g. openjdk-21-jdk-headless |
targetRelease | --multi-release option passed to jlink |
summary | rock image summary, e.g. Spring Boot Application |
description | path to the description file, e.g. README.md |
command | command used for the startup service |
source | Git URL of chisel-releases repository |
branch | Git branch of chisel-releases repository |
architectures | list of the supported architectures, e.g. amd64, arm64 |
slices | list of additional chisel slices to install |
rockcraftYaml | path to rockcraft.yaml with the overrides for the generated rockraft.yaml |
createService | create startup service (default true) |
Install rockcraft: snap install rockcraft
.
To use the plugin, apply the following two steps:
Groovy
plugins {
id 'io.github.rockcrafters.rockcraft' version '0.2.3'
}
Kotlin
plugins {
id("io.github.rockcrafters.rockcraft") version "0.2.3"
}
Groovy
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'io.github.rockcrafters.rockcraft:0.2.3'
}
}
apply plugin: 'io.github.rockcrafters.rockcraft-plugin'
Kotlin
buildscript {
repositories {
maven {
setUrl("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath("io.github.rockcrafters.rockcraft:0.2.3")
}
}
apply(plugin = "io.github.rockcrafters.rockcraft")
The plugin allows setting up container summary and description, target architectures and the startup service command line.
Groovy
rockcraft {
buildPackage = 'openjdk-21-jdk'
targetRelease = 21
summary = 'A ROCK summary'
description = 'README.md'
command = '/usr/bin/java -jar jars/application.jar'
source = 'http://github.com/myuser/chisel-releases'
branch = 'my-chisel-release-branch'
slices = ['busybox_bins', 'fontconfig_config']
architectures = ['amd64', 'arm64']
createService = false
rockcraftYaml = 'rockcraft.yaml'
}
Kotlin
rockcraft {
buildPackage = "openjdk-21-jdk"
targetRelease = 21
summary = "A ROCK summary"
description = "README.md"
command = "/usr/bin/java -jar jars/application.jar"
source = "http://github.com/myuser/chisel-releases"
branch = "my-chisel-release-branch"
slices("busybox_bins", "fontconfig_config")
architectures("amd64", "arm64")
createService = false
rockcraftYaml = "rockcraft.yaml"
}
Please see examples to try the sample projects.
Install rockcraft: snap install rockcraft
.
To use the plugin, apply the following two steps:
Apply the plugin:
<build>
<plugins>
...
<plugin>
<groupId>io.github.rockcrafters</groupId>
<artifactId>rockcraft-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<!-- creates rockcraft.yaml -->
<goal>create-rock</goal>
<!-- builds rock image -->
<goal>build-rock</goal>
<!-- pushes rock to the local docker daemon-->
<goal>push-rock</goal>
</goals>
</execution>
</executions>
<plugin>
</plugins>
<build>
The plugin supports all configuration options.
<plugins>
<plugin>
<groupId>io.github.rockcrafters</groupId>
<artifactId>rockcraft-maven-plugin</artifactId>
...
<configuration>
<buildPackage>openjdk-17-jdk-headless</buildPackage>
<targetRelease>17</targetRelease>
<jlink>false</jlink>
<summary>foo</summary>
<description>readme.txt</description>
<source>https://github.com/canonical/chisel-releases</source>
<branch>ubuntu-24.04</branch>
<architectures>
<architecture>amd64</architecture>
<architecture>arm64</architecture>
</architectures>
<slices>
<slice>busybox_bins</slice>
<slice>dash_bins</slice>
</slices>
</configuration>
</plugin>
Please see examples to try the sample projects.
Issues can be reported to the Issue tracker.
Contributions can be submitted via Pull requests,
- Error handling (empty jar file), no main class