Just starting with quarkus-mandrel to multistage docker build for a quarkus-resteasy example. Mac M1 pro - macOS Monterey - 8Cpu and 32GB memory Docker Deskop - VM - 6cpu Memory 16GB
FROM quay.io/quarkus/ubi-quarkus-mandrel:21.3-java11 AS build
USER root
COPY --chown=quarkus:quarkus mvnw /code/mvnw
COPY --chown=quarkus:quarkus .mvn /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
USER quarkus
WORKDIR /code
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
COPY src /code/src
RUN ./mvnw package -Pnative -Dquarkus.native.native-image-xmx=14g -Drelease.version=1.0
## Stage 2 : create the docker final image
FROM quay.io/quarkus/quarkus-micro-image:1.0
WORKDIR /work/
COPY --from=build /code/target/*-runner /work/application
# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& chmod -R "g+rwX" /work \
&& chown -R 1001:root /work
EXPOSE 9080
USER 1001
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
Docker Build
docker build -f src/main/docker/Dockerfile.multistage -t epp .
Build stuck at
=> [build 10/10] RUN ./mvnw package -Pnative -Dquarkus.native.native-image-xmx=14g -Drelease.version=1.0 3184.7s
=> => # [INFO] Building jar: /code/target/enterpiseplanprofile-1.0.0-SNAPSHOT.jar
=> => # [INFO]
=> => # [INFO] --- quarkus-maven-plugin:2.8.1.Final:build (default) @ enterpiseplanprofile ---
=> => # [WARNING] [io.quarkus.config] Unrecognized configuration key "quarkus.hibernate-orm.database.generation" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
=> => # [INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /code/target/enterpiseplanprofile-1.0.0-SNAPSHOT-native-image-source-jar/enterpiseplanprofile-1.0.0-SNAPSHOT-runner.jar
=> => # [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /code/target/enterpiseplanprofile-1.0.0-SNAPSHOT-native-image-source-jar/enterpiseplanprofile-1.0.0-SNAPSHOT-runner.jar
Appreciate any guidance..
Thanks Raj
Update 21.9: Work in https://github.com/quarkusio/quarkus-images/issues/83 has completed and multi-arch images are now available.
Original answer: The native image builder images are currently only x86 and the emulation of x86 on M1 would appear to be incredibly slow.
I briefly tried to boot up a multi-arch
registry.access.redhat.com/ubi8
image, and I was able to emulate the commands that the builder image would execute (assuming the right aarch64 dependencies installed). I was able to build native executables without any issues there.We're working to provide multi-arch versions of the builder images, but we're not there yet.