-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
90 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,4 +55,4 @@ jobs: | |
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./jvm.Dockerfile | ||
file: ./unpacked.Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
gradle-plugins/src/main/kotlin/dev.vlaship.git-properties.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
plugins { | ||
id("com.gorylenko.gradle-git-properties") | ||
} | ||
|
||
gitProperties { | ||
dateFormat = "yyyy-MM-dd HH:mm:ssZ" | ||
dateFormatTimeZone = "GMT" | ||
keys = arrayListOf("git.branch", "git.commit.id", "git.commit.id.abbrev", "git.commit.time", "git.tags") | ||
} |
31 changes: 15 additions & 16 deletions
31
gradle-plugins/src/main/kotlin/dev.vlaship.graalvm.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
plugins { | ||
id("java-library") | ||
// id("org.graalvm.buildtools.native") | ||
id("org.graalvm.buildtools.native") | ||
} | ||
|
||
//graalvmNative { | ||
// binaries { | ||
// named("main") { | ||
// imageName.set("app") | ||
// useFatJar.set(true) | ||
// } | ||
// } | ||
// binaries.all { | ||
// buildArgs.add("--verbose") | ||
// resources.autodetect() | ||
// } | ||
// | ||
// toolchainDetection.set(true) | ||
//} | ||
graalvmNative { | ||
binaries { | ||
named("main") { | ||
imageName.set("app") | ||
useFatJar.set(true) | ||
} | ||
} | ||
binaries.all { | ||
buildArgs.add("--verbose") | ||
resources.autodetect() | ||
} | ||
|
||
toolchainDetection.set(true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
gradle-plugins/src/main/kotlin/dev.vlaship.unpack.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import org.gradle.api.tasks.Copy | ||
import org.gradle.kotlin.dsl.task | ||
|
||
plugins { | ||
id("java-library") | ||
id("org.springframework.boot") | ||
} | ||
|
||
// task unpack | ||
task("unpack", type = Copy::class) { | ||
dependsOn("build") | ||
from(zipTree(tasks.bootJar.get().archiveFile.get())) | ||
into("build/unpacked") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
### Build stage | ||
# Builder | ||
FROM alpine:latest AS builder | ||
|
||
# Set the working directory inside the container | ||
WORKDIR / | ||
|
||
# Copy unpacked into the container | ||
COPY . . | ||
|
||
# Unpack the jar | ||
ARG UNPACKED=/backoffice-app/build/unpacked | ||
|
||
COPY ${UNPACKED}/BOOT-INF/lib /upacked/app/lib | ||
COPY ${UNPACKED}/META-INF /upacked/app/META-INF | ||
COPY ${UNPACKED}/BOOT-INF/classes /upacked/app | ||
|
||
### Run stage | ||
# Create a minimal production image | ||
FROM azul/zulu-openjdk-alpine:21-jre-headless | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Avoid running code as a root user | ||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
USER appuser | ||
|
||
# Copy only the necessary dirs and files from the builder stage | ||
COPY --from=builder /upacked/app /app | ||
|
||
# Run the binary when the container starts | ||
ENTRYPOINT ["java", "-cp", "/app:/app/lib/*", "dev.vlaship.backoffice.App"] |