From e16da90474b9d7b37624a9a15c3c0f7c96c4e965 Mon Sep 17 00:00:00 2001 From: George Wu Date: Thu, 26 Oct 2023 14:13:18 -0700 Subject: [PATCH 1/3] Fix dockerfile --- distribution/docker/Dockerfile | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile index 1c7933f09d39..95f36687dafe 100644 --- a/distribution/docker/Dockerfile +++ b/distribution/docker/Dockerfile @@ -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 " - -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 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.34.1-glibc as busybox + +FROM gcr.io/distroless/java$JDK_VERSION-debian11 +LABEL maintainer="Apache Druid Developers " + +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 From 16ddc1c2c49516f0162e7d36260fdd9546db9949 Mon Sep 17 00:00:00 2001 From: George Wu Date: Mon, 30 Oct 2023 13:30:58 -0400 Subject: [PATCH 2/3] Move to java17 --- distribution/docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile index 95f36687dafe..6435ff655700 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 @@ -66,9 +66,9 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \ echo "Downloading bash-static from ${BASH_URL}" \ && wget ${BASH_URL} -O /bin/bash -FROM busybox:1.34.1-glibc as busybox +FROM busybox:1.35.0-glibc as busybox -FROM gcr.io/distroless/java$JDK_VERSION-debian11 +FROM gcr.io/distroless/java$JDK_VERSION-debian12 LABEL maintainer="Apache Druid Developers " COPY --from=busybox /bin/busybox /busybox/busybox From 22e28b33b0ec358b3da0bcf2519614bd49c4e722 Mon Sep 17 00:00:00 2001 From: George Wu Date: Tue, 31 Oct 2023 13:13:55 -0400 Subject: [PATCH 3/3] tag alpine --- distribution/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile index 6435ff655700..2bcd28f873a6 100644 --- a/distribution/docker/Dockerfile +++ b/distribution/docker/Dockerfile @@ -49,7 +49,7 @@ 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 alpine as bash-static +FROM alpine:3 as bash-static ARG TARGETARCH # # Download bash-static binary to execute scripts that require bash.