xvrl commented on code in PR #13059:
URL: https://github.com/apache/druid/pull/13059#discussion_r969979435
##########
distribution/docker/Dockerfile:
##########
@@ -29,28 +35,47 @@ RUN export DEBIAN_FRONTEND=noninteractive \
COPY . /src
WORKDIR /src
-RUN if [ "$BUILD_FROM_SOURCE" = "true" ]; then \
+RUN --mount=type=cache,target=/root/.m2 if [ "$BUILD_FROM_SOURCE" = "true" ];
then \
mvn -B -ff -q dependency:go-offline \
install \
-Pdist,bundle-contrib-exts \
-Pskip-static-checks,skip-tests \
-Dmaven.javadoc.skip=true \
; fi
-RUN VERSION=$(mvn -B -q
org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
+RUN --mount=type=cache,target=/root/.m2 VERSION=$(mvn -B -q
org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
-Dexpression=project.version -DforceStdout=true \
) \
&& tar -zxf ./distribution/target/apache-druid-${VERSION}-bin.tar.gz -C /opt \
&& mv /opt/apache-druid-${VERSION} /opt/druid
-FROM amd64/busybox:1.30.0-glibc as busybox
+FROM busybox:1.35.0-glibc as busybox
-FROM gcr.io/distroless/java:$JDK_VERSION
+FROM gcr.io/distroless/java$JDK_VERSION-debian11
LABEL maintainer="Apache Druid Developers <[email protected]>"
COPY --from=busybox /bin/busybox /busybox/busybox
RUN ["/busybox/busybox", "--install", "/bin"]
+# Predefine builtin arg, see:
https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
+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.
+#
+ARG
BASH_URL_BASE="https://github.com/robxu9/bash-static/releases/download/5.1.016-1.2.3"
+RUN if [ "$TARGETARCH" = "arm64" ]; then \
+ export BASH_URL=$(echo ${BASH_URL_BASE}/bash-linux-aarch64) ; \
+ elif [ "$TARGETARCH" = "amd64" ]; then \
+ export BASH_URL=$(echo ${BASH_URL_BASE}/bash-linux-x86_64) ; \
+ else \
+ echo "Unknown archtecture($TARGETARCH)" && exit ; \
Review Comment:
we should call exit with a non-zero error code to ensure the build fails
when building with an unsupported architecture
```suggestion
echo "Unknown archtecture($TARGETARCH)" && exit 1; \
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]