Quarkus-Mandrel 本机构建 运行 永远

Quarkus-Mandrel native build running forever

刚开始使用 quarkus-mandrel 进行多阶段 docker 构建 quarkus-resteasy 示例。 Mac M1 pro - macOS Monterey - 8Cpu 和 32GB 内存 Docker 桌面 - VM - 6cpu 内存 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 构建

docker build  -f src/main/docker/Dockerfile.multistage -t epp .

构建停留在

=> [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

感谢任何指导..

谢谢 拉吉

本机图像生成器图像目前只有 x86,在 M1 上模拟 x86 会显得非常慢。

我短暂地尝试启动一个 multi-arch registry.access.redhat.com/ubi8 图像,并且我能够模拟构建器图像将执行的命令(假设安装了正确的 aarch64 依赖项)。我能够毫无问题地构建本机可执行文件。

我们正在努力提供 multi-arch 版本的构建器映像,但我们还没有做到这一点。