This is an automated email from the ASF dual-hosted git repository. jonwei pushed a commit to branch multiarchtest in repository https://gitbox.apache.org/repos/asf/druid.git
commit 3a6e202853dbe5f38e0c7117e35dcc8127d1b815 Author: jon-wei <jon....@imply.io> AuthorDate: Tue Oct 31 13:29:41 2023 -0500 Multiarch docker build test --- distribution/docker/Dockerfile | 31 +++++++++++--------- .../docker/{Dockerfile => Dockerfile.arm64} | 33 ++++++++++++---------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile index 1c7933f09d3..07c62c0adbf 100644 --- a/distribution/docker/Dockerfile +++ b/distribution/docker/Dockerfile @@ -17,7 +17,7 @@ # under the License. # -ARG JDK_VERSION=11 +ARG JDK_VERSION=17 # The platform is explicitly specified as x64 to build the Druid distribution. # This is because it's not able to build the distribution on arm64 due to dependency problem of web-console. See: https://github.com/apache/druid/issues/13012 @@ -49,17 +49,8 @@ RUN --mount=type=cache,target=/root/.m2 VERSION=$(mvn -B -q org.apache.maven.plu && tar -zxf ./distribution/target/apache-druid-${VERSION}-bin.tar.gz -C /opt \ && mv /opt/apache-druid-${VERSION} /opt/druid -FROM busybox:1.34.1-glibc as busybox - -FROM gcr.io/distroless/java$JDK_VERSION-debian11 -LABEL maintainer="Apache Druid Developers <d...@druid.apache.org>" - -COPY --from=busybox /bin/busybox /busybox/busybox -RUN ["/busybox/busybox", "--install", "/bin"] - -# Predefined builtin arg, see: https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope +FROM alpine:3 as bash-static ARG TARGETARCH - # # Download bash-static binary to execute scripts that require bash. # Although bash-static supports multiple platforms, but there's no need for us to support all those platform, amd64 and arm64 are enough. @@ -73,12 +64,24 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \ echo "Unsupported architecture ($TARGETARCH)" && exit 1; \ fi; \ echo "Downloading bash-static from ${BASH_URL}" \ - && wget ${BASH_URL} -O /bin/bash \ - && chmod 755 /bin/bash + && wget ${BASH_URL} -O /bin/bash + +FROM busybox:1.35.0-glibc as busybox + +FROM gcr.io/distroless/java$JDK_VERSION-debian12 +LABEL maintainer="Apache Druid Developers <d...@druid.apache.org>" + +COPY --from=busybox /bin/busybox /busybox/busybox +RUN ["/busybox/busybox", "--install", "/bin"] + RUN addgroup -S -g 1000 druid \ && adduser -S -u 1000 -D -H -h /opt/druid -s /bin/sh -g '' -G druid druid + +COPY --from=bash-static /bin/bash /bin/bash +RUN chmod 755 /bin/bash + COPY --chown=druid:druid --from=builder /opt /opt COPY distribution/docker/druid.sh /druid.sh COPY distribution/docker/peon.sh /peon.sh @@ -94,4 +97,4 @@ USER druid VOLUME /opt/druid/var WORKDIR /opt/druid -ENTRYPOINT ["/druid.sh"] +ENTRYPOINT ["/druid.sh"] \ No newline at end of file diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile.arm64 similarity index 90% copy from distribution/docker/Dockerfile copy to distribution/docker/Dockerfile.arm64 index 1c7933f09d3..1773df14a4a 100644 --- a/distribution/docker/Dockerfile +++ b/distribution/docker/Dockerfile.arm64 @@ -17,13 +17,13 @@ # under the License. # -ARG JDK_VERSION=11 +ARG JDK_VERSION=17 # The platform is explicitly specified as x64 to build the Druid distribution. # This is because it's not able to build the distribution on arm64 due to dependency problem of web-console. See: https://github.com/apache/druid/issues/13012 # Since only java jars are shipped in the final image, it's OK to build the distribution on x64. # Once the web-console dependency problem is resolved, we can remove the --platform directive. -FROM --platform=linux/amd64 maven:3.8.6-jdk-11-slim as builder +FROM --platform=linux/arm64 maven:3.8.6-jdk-11-slim as builder # Rebuild from source in this stage # This can be unset if the tarball was already built outside of Docker @@ -49,17 +49,8 @@ RUN --mount=type=cache,target=/root/.m2 VERSION=$(mvn -B -q org.apache.maven.plu && tar -zxf ./distribution/target/apache-druid-${VERSION}-bin.tar.gz -C /opt \ && mv /opt/apache-druid-${VERSION} /opt/druid -FROM busybox:1.34.1-glibc as busybox - -FROM gcr.io/distroless/java$JDK_VERSION-debian11 -LABEL maintainer="Apache Druid Developers <d...@druid.apache.org>" - -COPY --from=busybox /bin/busybox /busybox/busybox -RUN ["/busybox/busybox", "--install", "/bin"] - -# Predefined builtin arg, see: https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope +FROM alpine:3 as bash-static ARG TARGETARCH - # # Download bash-static binary to execute scripts that require bash. # Although bash-static supports multiple platforms, but there's no need for us to support all those platform, amd64 and arm64 are enough. @@ -73,12 +64,24 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \ echo "Unsupported architecture ($TARGETARCH)" && exit 1; \ fi; \ echo "Downloading bash-static from ${BASH_URL}" \ - && wget ${BASH_URL} -O /bin/bash \ - && chmod 755 /bin/bash + && wget ${BASH_URL} -O /bin/bash + +FROM busybox:1.35.0-glibc as busybox + +FROM gcr.io/distroless/java$JDK_VERSION-debian12 +LABEL maintainer="Apache Druid Developers <d...@druid.apache.org>" + +COPY --from=busybox /bin/busybox /busybox/busybox +RUN ["/busybox/busybox", "--install", "/bin"] + RUN addgroup -S -g 1000 druid \ && adduser -S -u 1000 -D -H -h /opt/druid -s /bin/sh -g '' -G druid druid + +COPY --from=bash-static /bin/bash /bin/bash +RUN chmod 755 /bin/bash + COPY --chown=druid:druid --from=builder /opt /opt COPY distribution/docker/druid.sh /druid.sh COPY distribution/docker/peon.sh /peon.sh @@ -94,4 +97,4 @@ USER druid VOLUME /opt/druid/var WORKDIR /opt/druid -ENTRYPOINT ["/druid.sh"] +ENTRYPOINT ["/druid.sh"] \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org