finish dependency update, also use the newer docker file template haha
All checks were successful
Build & Publish / build (push) Successful in 13m6s
All checks were successful
Build & Publish / build (push) Successful in 13m6s
This commit is contained in:
parent
6fa42168ac
commit
bf93c329b7
3 changed files with 62 additions and 22 deletions
|
@ -2,17 +2,17 @@ import dev.kordex.gradle.plugins.docker.file.*
|
|||
import dev.kordex.gradle.plugins.kordex.DataCollection
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
kotlin("plugin.serialization")
|
||||
distribution
|
||||
|
||||
id("com.github.johnrengelman.shadow")
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
|
||||
id("dev.kordex.gradle.docker")
|
||||
id("dev.kordex.gradle.kordex")
|
||||
alias(libs.plugins.kordex.plugin)
|
||||
alias(libs.plugins.kordex.docker)
|
||||
}
|
||||
|
||||
group = "dev.jansel"
|
||||
version = "1.1-SNAPSHOT"
|
||||
version = "1.2-SNAPSHOT"
|
||||
|
||||
dependencies {
|
||||
|
||||
|
@ -31,9 +31,26 @@ dependencies {
|
|||
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 {
|
||||
kordExVersion = "2.3.1-SNAPSHOT"
|
||||
jvmTarget = 21
|
||||
ignoreIncompatibleKotlinVersion = true
|
||||
|
||||
bot {
|
||||
// See https://docs.kordex.dev/data-collection.html
|
||||
|
@ -58,37 +75,51 @@ docker {
|
|||
// Each function (aside from comment/emptyLine) corresponds to a Dockerfile instruction.
|
||||
// See: https://docs.docker.com/reference/dockerfile/
|
||||
|
||||
from("azul/zulu-openjdk-alpine:21-jre-headless-latest")
|
||||
from("openjdk:21-jdk-slim")
|
||||
|
||||
emptyLine()
|
||||
|
||||
comment("Create required directories")
|
||||
runShell("mkdir -p /bot/plugins")
|
||||
runShell("mkdir -p /bot/data")
|
||||
|
||||
emptyLine()
|
||||
|
||||
copy("build/libs/$name-*-all.jar", "/bot/bot.jar")
|
||||
runShell("mkdir -p /dist/out")
|
||||
|
||||
emptyLine()
|
||||
|
||||
// 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/plugins") // Plugin ZIP/JAR location
|
||||
|
||||
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")
|
||||
|
||||
emptyLine()
|
||||
|
||||
entryPointExec(
|
||||
"java", "-Xmx2G",
|
||||
"-jar", "/bot/bot.jar"
|
||||
)
|
||||
comment("Run the distribution start script")
|
||||
entryPointExec("/dist/out/${project.name}-${project.version}/bin/$name")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.wrapper {
|
||||
gradleVersion = "8.14.2"
|
||||
distributionType = Wrapper.DistributionType.BIN
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue