JVM Gradle¶
This configuration is suitable if the project is built using Gradle and runs on a JVM. In this case, the project can be written in languages such as Java or Kotlin.
You can write a yaml file yourself using the instructions below, or use our yaml generator by clicking on link.
Section meta¶
The meta
section of the amverum.yml
file will look like this:
meta:
environment: jvm
toolchain:
name: gradle
version: 11
The parameters that can be changed here are meta.toolchain.version
. Logically, this is the version of the JDK that should be used for the build. Technically, the value of version
is substituted into the name of the Docker image that will be used.
For the build phase, this is gradle:jdk${meta.toolchain.version}
. Valid values can be seen on the docker hub page.
For the run phase, this is bellsoft/liberica-openjre-debian:${meta.toolchain.version}
. Valid values can be seen on the [docker hub] page.(https://hub.docker.com/r/bellsoft/liberica-openjre-debian/tags).
Important
The value of meta.toolchain.version must be valid for both the build and run phases. A simple LTS JDK version number is best.
Section build¶
The following parameters can be specified in the build
section:
image
args
artifacts
The image
parameter allows you to use a different build image than the one provided by Amverum. The image must meet the following requirements:
the source code for the build is expected in the /app folder (or image, no matter where the source code is located);
the image contains the
gradle
command, which can be called by name (without specifying an absolute path) with thebuild
parameter.
The args
parameter allows you to specify additional parameters to the gradle build ${build.args}
command. For example, to set the server.port
property:
build:
args: -Dserver.port=80
In this case, the command gradle build -Dserver.port=80
will be executed for the build.
The artifacts
parameter allows you to specify which files should be included in the final application. By default, all files with the jar
extension from the build/libs
folder will be copied to the root of the application folder.
The artifacts
parameter, unlike other parameters, is not a string, but a dictionary. The key in it is the mask of the source files to copy, and the value is the folder to which the files will be copied.
So, the default value of artifacts
is:
build:
artifacts:
"build/libs/*.jar": /
We use the following copying rules:
only relative paths are specified as a source (without / at the beginning);
if a file matches the mask, the file will be copied to the destination folder without the source path;
if a folder matches the mask, it will be copied entirely to the destination folder along with all its contents.
Section run¶
The following parameters can be used in the run
network:
jarName
image
persistenceMount
containerPort
The jarName
parameter is mandatory. It specifies the path to a file with the jar
extension that should be run with the java -jar ${run.jarName}
command. Example:
run:
jarName: bin/bag-end.jar
The image
parameter allows you to use a different image for the build, not the one offered by Amverum. The image must meet the following requirements:
the build result is expected in the /app folder (or image, no matter where the build result is located);
the image contains the
java
command, which can be called by name (without specifying the absolute path) with the-jar image_name
parameters.
The persistenceMount
parameter allows you to specify in which directory the folder with persistent storage will be mounted.
The default value is /data
.
The containerPort
parameter allows you to specify which port the application listens on. The default value is 80
.
Recipes¶
Minimal amverum.yml file¶
meta:
environment: jvm
toolchain:
name: gradle
version: 11
run:
jarName: bag-end.jar
Spring Boot¶
meta:
environment: jvm
toolchain:
name: gradle
version: 11
run:
jarName: bag-end-1.0.0.jar
containerPort: 8080