Skip to content

Instantly share code, notes, and snippets.

@franzwong
Created February 17, 2024 14:37
Show Gist options
  • Save franzwong/bfab6f02ca6ddb29fb37bfba263d6bf9 to your computer and use it in GitHub Desktop.
Save franzwong/bfab6f02ca6ddb29fb37bfba263d6bf9 to your computer and use it in GitHub Desktop.
Multistage docker build of Quarkus native with GraalVM
FROM ghcr.io/graalvm/native-image-community:21 as build
WORKDIR /workspace/app
COPY .mvn .mvn
COPY mvnw .
COPY pom.xml .
COPY src src
RUN ./mvnw install -Dnative
VOLUME /root/.m2
# glibc version must match the one used in the builder image
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.3
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --from=build --chown=1001:root /workspace/app/target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment