Skip to content

Commit

Permalink
Add Dockerfile.native
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmusin committed Mar 1, 2024
1 parent c371f21 commit ad15844
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Dockerfile.native
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:latest

RUN apt-get update && apt-get install -y curl zip unzip zlib1g-dev g++
RUN curl -s "https://get.sdkman.io" | bash && bash -c "source \"$HOME/.sdkman/bin/sdkman-init.sh\" && sdk install java 23.1.2.r21-nik"
ENV JAVA_HOME /root/.sdkman/candidates/java/current

WORKDIR /app
COPY . /app
RUN --mount=type=secret,id=application_yaml,dst=application.yaml cp application.yaml src/main/resources/application.yaml
RUN chmod +x gradlew && ./gradlew nativeTest nativeCompile

FROM alpine:latest
RUN apk add gcompat
COPY --from=0 /app/build/native/nativeCompile/polybacs app
ENTRYPOINT ["./app"]
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "3.2.3"
id("io.spring.dependency-management") version "1.1.4"
// id("org.graalvm.buildtools.native") version "0.10.1" // Enable when bellsoft/liberica-native-image-kit-container for JDK 21 is available
// https://hub.docker.com/r/bellsoft/liberica-native-image-kit-container/tags?page=1&name=jdk-21
id("org.graalvm.buildtools.native") version "0.10.1"
kotlin("jvm") version "1.9.22"
kotlin("plugin.spring") version "1.9.22"
}
Expand Down

0 comments on commit ad15844

Please sign in to comment.