RED-7784 - Buildpack to install fontconfig

This commit is contained in:
Andrei Isvoran 2023-11-09 11:32:00 +01:00
parent ee92515f30
commit 0ee1ee5054
2 changed files with 33 additions and 1 deletions

View File

@ -54,10 +54,26 @@ dependencies {
tasks.named<BootBuildImage>("bootBuildImage") {
imageName.set("nexus.knecon.com:5001/red/${project.name}:${project.version}")
environment.put("BPE_DELIM_JAVA_TOOL_OPTIONS", " ")
environment.put("BPE_APPEND_JAVA_TOOL_OPTIONS", "-Dfile.encoding=UTF-8")
environment.put("BPE_FONTCONFIG_PATH", "/layers/fagiani_apt/apt/etc/fonts/")
val aptFile = layout.projectDirectory.file("src/main/resources/Aptfile").toString()
bindings.add("${aptFile}:/workspace/Aptfile:ro")
buildpacks.set(
listOf(
"ghcr.io/fagiani/buildpacks/fagiani_apt@sha256:6471c8c70f32b749e29f65ae562ac0339fecad26aa9217628c00a6c31f197dae",
"urn:cnb:builder:paketo-buildpacks/java"
)
)
imageName.set("nexus.knecon.com:5001/red/${project.name}:cache") // must build image with same name always, otherwise the builder will not know which image to use as cache. DO NOT CHANGE!
if (project.hasProperty("buildbootDockerHostNetwork")) {
network.set("host")
}
docker {
if (project.hasProperty("buildbootDockerHostNetwork")) {
bindHostToBuilder.set(true)
@ -70,5 +86,20 @@ tasks.named<BootBuildImage>("bootBuildImage") {
email.set(providers.gradleProperty("mavenEmail").getOrNull())
url.set("https://nexus.knecon.com:5001/")
}
doLast {
// after the build has been finished, retag the created image with the correct version and push to registry
val dockerTag = "nexus.knecon.com:5001/red/${project.name}:${project.version}"
println("Tagging image as $dockerTag")
project.exec {
commandLine("docker", "tag", imageName.get(), dockerTag)
}
if (publish.get()) {
println("Publishing $dockerTag")
project.exec {
commandLine("docker", "push", dockerTag)
}
}
}
}
}