Skip to content

Commit

Permalink
build: Change how docker file is generated
Browse files Browse the repository at this point in the history
  • Loading branch information
utfunderscore committed Aug 20, 2024
1 parent 54d345e commit 8f1e30d
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions Server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import java.util.Properties
plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
kotlin("jvm")
id("com.bmuschko.docker-java-application") version "9.4.0"
}

group = "org.readutf.orchestrator"
Expand Down Expand Up @@ -62,7 +61,25 @@ tasks.jar {
manifest {
attributes["Main-Class"] = "org.readutf.orchestrator.server.ServerStarterKt"
}
finalizedBy("dockerBuildImage")
finalizedBy("generateDockerFile")
}

tasks.register("generateDockerFile") {

File("$buildDir/Dockerfile").writeText(
"""
FROM eclipse-temurin:21-jdk-jammy as deps
WORKDIR /orchestrator
ADD https://github.com/utfunderscore/orchestrator/releases/download/latest/Server-$version-all.jar /orchestrator
EXPOSE 2980
EXPOSE 9393
CMD ["java", "-jar", "Server-$version-all.jar"]
""".trimIndent(),
)
}

tasks.register("createProperties") {
Expand All @@ -78,15 +95,6 @@ tasks.register("createProperties") {
}
}

docker {
javaApplication {
group = "utfunderscore"
baseImage.set("eclipse-temurin:21-jdk-jammy")
images.set(listOf("utfunderscore/orchestrator:$version"))
ports.set(listOf(2980, 9393))
}
}

tasks.named("classes") {
dependsOn("createProperties")
}
Expand Down

0 comments on commit 8f1e30d

Please sign in to comment.