Skip to content

Instantly share code, notes, and snippets.

@linux-china
Last active May 13, 2022 18:21
Show Gist options
  • Save linux-china/5c752dd127d2068aca4be64683049595 to your computer and use it in GitHub Desktop.
Save linux-china/5c752dd127d2068aca4be64683049595 to your computer and use it in GitHub Desktop.
Build Docker image for JBang script with GraalVM native-image
FROM linuxchina/jbang-action:0.94.0-graal-java17-22.1.0 as builder
ARG mainClass="Hello2.java"
RUN mkdir -p /opt/app/out
WORKDIR /opt/app
COPY $mainClass /opt/app
RUN jbang export portable --native -O out/main $mainClass
#RUN upx -7 out/main
FROM paketobuildpacks/run:tiny-cnb
COPY --from=builder /opt/app/out /opt/app/out
ENTRYPOINT ["/opt/app/out/main"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment