File tree Expand file tree Collapse file tree 2 files changed +26
-9
lines changed
Expand file tree Collapse file tree 2 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 1- FROM gcr.io/distroless/java17-debian11
2- COPY build/libs/tms-varsel-api-all.jar app/app.jar
3- ENV PORT=8080
4- EXPOSE $PORT
5- WORKDIR app
6- CMD ["app.jar" ]
1+ FROM ghcr.io/navikt/baseimages/temurin:21
2+
3+ ENV JAVA_OPTS='-XX:MaxRAMPercentage=75'
4+
5+ COPY build/libs/*.jar ./
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
33plugins {
44 kotlin(" jvm" ).version(Kotlin .version)
55
6- id(Shadow .pluginId) version (Shadow .version)
7-
86 application
97}
108
@@ -55,8 +53,10 @@ dependencies {
5553 testImplementation(Mockk .mockk)
5654}
5755
56+ val projectMainClass = " no.nav.tms.varsel.api.ApplicationKt"
57+
5858application {
59- mainClass.set(" no.nav.tms.varsel.api.ApplicationKt " )
59+ mainClass.set(projectMainClass )
6060}
6161
6262tasks {
@@ -70,3 +70,21 @@ tasks {
7070 }
7171 }
7272}
73+
74+ tasks {
75+ withType<Jar > {
76+ archiveBaseName.set(" app" )
77+ manifest {
78+ attributes[" Main-Class" ] = projectMainClass
79+ attributes[" Class-Path" ] = configurations.runtimeClasspath.get().joinToString(separator = " " ) {
80+ it.name
81+ }
82+ }
83+ doLast {
84+ configurations.runtimeClasspath.get().forEach {
85+ val file = File (" ${layout.buildDirectory.get()} /libs/${it.name} " )
86+ if (! file.exists()) it.copyTo(file)
87+ }
88+ }
89+ }
90+ }
You can’t perform that action at this time.
0 commit comments