Created
May 20, 2020 08:41
-
-
Save reitzig/fbd5bb9e02a4b1fc9eeffa7544d25732 to your computer and use it in GitHub Desktop.
UBI Minimial with Kotlin Native
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
FROM registry.access.redhat.com/ubi7/ubi:latest AS build | |
RUN yum -y install --disableplugin=subscription-manager \ | |
java-11-openjdk | |
ARG kotlin_version=1.3.72 | |
RUN curl -LO https://github.com/JetBrains/kotlin/releases/download/v${kotlin_version}/kotlin-native-linux-${kotlin_version}.tar.gz \ | |
&& tar -xzf kotlin-native-linux-${kotlin_version}.tar.gz \ | |
&& rm kotlin-native-linux-${kotlin_version}.tar.gz | |
# Run compiler once so it downloads native dependencies into a separate layer | |
RUN export PATH=kotlin-native-linux-${kotlin_version}/bin:$PATH \ | |
&& echo "fun main() { println(\"Foo!\") }" > foo.kt \ | |
&& kotlinc-native foo.kt -o foo \ | |
&& rm foo* | |
COPY hello-world.kt ./ | |
RUN export PATH=kotlin-native-linux-${kotlin_version}/bin:$PATH \ | |
&& kotlinc-native hello-world.kt -o hello-world | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
FROM registry.access.redhat.com/ubi7/ubi-minimal:latest AS run | |
COPY --from=build hello-world.kexe ./hello-world | |
CMD ./hello-world |
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
fun main() { | |
println("Hello World, I'm Kotlin Native!") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For UBI 8: