1

我正在尝试使用 Mandrel 在本机模式下构建 Quarkus,如下所述:https ://quarkus.io/guides/building-native-image#container-runtime

由于我的 CI 管道的限制,我需要使用多阶段 docker-build 手动执行此操作:https ://quarkus.io/guides/building-native-image#using-a-multi-stage-docker-建造

但是现在我不知道要更改什么Dockerfile,如果我想使用 Mandrel-image:

## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/centos-quarkus-maven:20.1.0-java11 AS build
COPY pom.xml /usr/src/app/
RUN mvn -f /usr/src/app/pom.xml -B de.qaware.maven:go-offline-maven-plugin:1.2.5:resolve-dependencies
COPY src /usr/src/app/src
USER root
RUN chown -R quarkus /usr/src/app
USER quarkus
RUN mvn -f /usr/src/app/pom.xml -Pnative clean package

## Stage 2 : create the docker final image
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=build /usr/src/app/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 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

我敢肯定它一定很简单,但我现在不明白。有什么建议么?

4

0 回答 0