finish dependency update, also use the newer docker file template haha
All checks were successful
Build & Publish / build (push) Successful in 13m6s

This commit is contained in:
Jannik Reimers 2025-06-16 02:20:25 +02:00
parent 6fa42168ac
commit bf93c329b7
Signed by: jansel
GPG key ID: 39C62D7D5233CFD0
3 changed files with 62 additions and 22 deletions

2
.idea/kotlinc.xml generated
View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="KotlinJpsPluginSettings"> <component name="KotlinJpsPluginSettings">
<option name="version" value="2.1.0" /> <option name="version" value="2.1.21" />
</component> </component>
</project> </project>

View file

@ -2,17 +2,17 @@ import dev.kordex.gradle.plugins.docker.file.*
import dev.kordex.gradle.plugins.kordex.DataCollection import dev.kordex.gradle.plugins.kordex.DataCollection
plugins { plugins {
kotlin("jvm") distribution
kotlin("plugin.serialization")
id("com.github.johnrengelman.shadow") alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
id("dev.kordex.gradle.docker") alias(libs.plugins.kordex.plugin)
id("dev.kordex.gradle.kordex") alias(libs.plugins.kordex.docker)
} }
group = "dev.jansel" group = "dev.jansel"
version = "1.1-SNAPSHOT" version = "1.2-SNAPSHOT"
dependencies { dependencies {
@ -31,9 +31,26 @@ dependencies {
implementation(libs.logging) implementation(libs.logging)
} }
// Configure distributions plugin
distributions {
main {
distributionBaseName = project.name
contents {
// Copy the LICENSE file into the distribution
from("LICENSE")
// Exclude src/main/dist/README.md
exclude("README.md")
}
}
}
kordEx { kordEx {
kordExVersion = "2.3.1-SNAPSHOT" kordExVersion = "2.3.1-SNAPSHOT"
jvmTarget = 21 jvmTarget = 21
ignoreIncompatibleKotlinVersion = true
bot { bot {
// See https://docs.kordex.dev/data-collection.html // See https://docs.kordex.dev/data-collection.html
@ -58,37 +75,51 @@ docker {
// Each function (aside from comment/emptyLine) corresponds to a Dockerfile instruction. // Each function (aside from comment/emptyLine) corresponds to a Dockerfile instruction.
// See: https://docs.docker.com/reference/dockerfile/ // See: https://docs.docker.com/reference/dockerfile/
from("azul/zulu-openjdk-alpine:21-jre-headless-latest") from("openjdk:21-jdk-slim")
emptyLine() emptyLine()
comment("Create required directories")
runShell("mkdir -p /bot/plugins") runShell("mkdir -p /bot/plugins")
runShell("mkdir -p /bot/data") runShell("mkdir -p /bot/data")
runShell("mkdir -p /dist/out")
emptyLine()
copy("build/libs/$name-*-all.jar", "/bot/bot.jar")
emptyLine() emptyLine()
// Add volumes for locations that you need to persist. This is important! // Add volumes for locations that you need to persist. This is important!
comment("Declare required volumes")
volume("/bot/data") // Storage for data files volume("/bot/data") // Storage for data files
volume("/bot/plugins") // Plugin ZIP/JAR location volume("/bot/plugins") // Plugin ZIP/JAR location
emptyLine() emptyLine()
comment("Copy the distribution files into the container")
copy("build/distributions/${project.name}-${project.version}.tar", "/dist")
emptyLine()
comment("Extract the distribution files, and prepare them for use")
runShell("tar -xf /dist/${project.name}-${project.version}.tar -C /dist/out")
if (file("src/main/dist/plugins").isDirectory) {
runShell("mv /dist/out/${project.name}-${project.version}/plugins/* /bot/plugins")
}
runShell("chmod +x /dist/out/${project.name}-${project.version}/bin/$name")
emptyLine()
comment("Clean up unnecessary files")
runShell("rm /dist/${project.name}-${project.version}.tar")
emptyLine()
comment("Set the correct working directory")
workdir("/bot") workdir("/bot")
emptyLine() emptyLine()
entryPointExec( comment("Run the distribution start script")
"java", "-Xmx2G", entryPointExec("/dist/out/${project.name}-${project.version}/bin/$name")
"-jar", "/bot/bot.jar"
)
} }
} }
tasks.wrapper {
gradleVersion = "8.14.2"
distributionType = Wrapper.DistributionType.BIN
}

View file

@ -1,5 +1,5 @@
[versions] [versions]
kotlin = "2.1.0" # Note: Plugin versions must be updated in the settings.gradle.kts too kotlin = "2.1.21" # Note: Plugin versions must be updated in the settings.gradle.kts too
groovy = "3.0.25" groovy = "3.0.25"
jansi = "2.4.2" jansi = "2.4.2"
@ -11,6 +11,7 @@ twitch4j = "1.25.0"
events4j = "0.12.2" events4j = "0.12.2"
kx-coroutines = "1.10.2" kx-coroutines = "1.10.2"
kmongo = "5.2.1" kmongo = "5.2.1"
kordex-gradle = "1.7.1"
[libraries] [libraries]
groovy = { module = "org.codehaus.groovy:groovy", version.ref = "groovy" } groovy = { module = "org.codehaus.groovy:groovy", version.ref = "groovy" }
@ -24,3 +25,11 @@ logging = { module = "io.github.oshai:kotlin-logging", version.ref = "logging" }
twitch4j = { module = "com.github.twitch4j:twitch4j", version.ref = "twitch4j" } twitch4j = { module = "com.github.twitch4j:twitch4j", version.ref = "twitch4j" }
events4j = { module = "com.github.philippheuer.events4j:events4j-handler-reactor", version.ref = "events4j" } events4j = { module = "com.github.philippheuer.events4j:events4j-handler-reactor", version.ref = "events4j" }
kmongo = { module="org.litote.kmongo:kmongo-coroutine-serialization", version.ref = "kmongo" } kmongo = { module="org.litote.kmongo:kmongo-coroutine-serialization", version.ref = "kmongo" }
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kordex-docker = { id = "dev.kordex.gradle.docker", version.ref = "kordex-gradle" }
kordex-plugin = { id = "dev.kordex.gradle.kordex", version.ref = "kordex-gradle" }