From d1d6228b774ff9deb5b56829600bda08ffe804b8 Mon Sep 17 00:00:00 2001 From: Erik Merkle Date: Tue, 1 Apr 2025 07:12:31 -0500 Subject: [PATCH] Attempt to replace Netty jars with ARM compatible ones --- dse/Dockerfile-dse6.9.jdk11 | 29 ++++++++++++++++++++++++++++- dse/Dockerfile-dse6.9.ubi8 | 12 +++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dse/Dockerfile-dse6.9.jdk11 b/dse/Dockerfile-dse6.9.jdk11 index a6be04bb..3783862c 100644 --- a/dse/Dockerfile-dse6.9.jdk11 +++ b/dse/Dockerfile-dse6.9.jdk11 @@ -3,7 +3,31 @@ # ARG DSE_VERSION=6.9.7 ARG DS_BASE_DEBIAN=ds-base-ubuntu-openjdk-11 -ARG BASETAG=11.0.22-jdk-ubuntu-20240427 +ARG BASETAG=11.0.26-4-1ubuntu1-20.04 +FROM --platform=$BUILDPLATFORM maven:3.8.6-openjdk-11-slim AS netty-setup-base +COPY settings.xml /root/.m2/settings.xml +RUN set -x \ + && mvn dependency:get -Dartifact=io.netty:netty-all:4.1.100.2.dse \ + && mvn dependency:get -Dtransitive=false -Dartifact=io.netty:netty-transport-native-epoll:4.1.100.2.dse \ + && mvn dependency:get -Dtransitive=false -Dartifact=io.netty:netty-transport-native-kqueue:4.1.100.2.dse \ + ## The artifacts below don't seem to be present yet, we'll need them for ARM images to work on OSX +# && mvn dependency:get -Dtransitive=false -Dartifact=io.netty:netty-transport-native-kqueue:4.1.100.2.dse:jar:osx-x86_64 \ +# && mvn dependency:get -Dtransitive=false -Dartifact=io.netty:netty-transport-native-kqueue:4.1.100.2.dse:jar:osx-aarch_64 \ + && mkdir /netty \ + && find ~/.m2/repository/io/netty -type f -name "netty*4.1.100.2.dse*.jar" -exec cp {} /netty/ \; + +FROM --platform=linux/arm64 netty-setup-base as netty-setup-arm64 +RUN set -x \ + && mvn dependency:get -Dtransitive=false -Dartifact=io.netty:netty-transport-native-epoll:4.1.100.2.dse:jar:linux-aarch_64 \ + && find ~/.m2/repository/io/netty -type f -name "netty*4.1.100.2.dse*.jar" -exec cp {} /netty/ \; + +FROM --platform=linux/amd64 netty-setup-base as netty-setup-amd64 +RUN set -x \ + && mvn dependency:get -Dtransitive=false -Dartifact=io.netty:netty-transport-native-epoll:4.1.100.2.dse:jar:linux-x86_64 \ + && find ~/.m2/repository/io/netty -type f -name "netty*4.1.100.2.dse*.jar" -exec cp {} /netty/ \; + +FROM netty-setup-${TARGETARCH} as netty-setup + FROM datastax/${DS_BASE_DEBIAN}:${BASETAG} AS dse-server-prep # Set up configuration variables @@ -26,6 +50,8 @@ RUN set -x \ && mkdir -p "$DSE_HOME" \ && tar -C "$DSE_HOME" --strip-components=1 -xzf /${TARBALL} \ && rm /${TARBALL} \ +# Replace Netty with ARM compatible version + && find ${DSE_HOME}/resources/cassandra/lib/ -type f -name "netty*" -exec rm {} \; \ # Unpack Agent tarball && mkdir -p "$DSE_AGENT_HOME" \ && tar -C "$DSE_AGENT_HOME" --strip-components=1 -xzf /${DSE_AGENT_TARBALL} \ @@ -35,6 +61,7 @@ RUN set -x \ && apt-get install -y --install-recommends rdfind \ && rdfind -makehardlinks true -makeresultsfile false ${DSE_HOME} \ && chmod -R g+w ${DSE_HOME} ${DSE_AGENT_HOME} +COPY --chown=dse:root --from=netty-setup /netty ${DSE_HOME}/resources/cassandra/lib/ COPY dse/patches/remove-writable.patch /tmp RUN patch ${DSE_HOME}/bin/dse < /tmp/remove-writable.patch diff --git a/dse/Dockerfile-dse6.9.ubi8 b/dse/Dockerfile-dse6.9.ubi8 index 773302f3..c3bd34ab 100644 --- a/dse/Dockerfile-dse6.9.ubi8 +++ b/dse/Dockerfile-dse6.9.ubi8 @@ -3,7 +3,17 @@ ARG UBI_MAJOR=8 ARG UBI_BASETAG=latest ARG DSE_BASE_IMAGE=datastax/dse-mgmtapi-6_8:${DSE_VERSION}-jdk11 -FROM ${DSE_BASE_IMAGE} AS dse-server-base +FROM --platform=$BUILDPLATFORM ${DSE_BASE_IMAGE} AS dse-server-base-amd64 +ENV DSE_HOME=/opt/dse +RUN set -x \ + && rm ${DSE_HOME}/resources/cassandra/lib/netty*aarch* + +FROM --platform=$BUILDPLATFORM ${DSE_BASE_IMAGE} AS dse-server-base-arm64 +ENV DSE_HOME=/opt/dse +RUN set -x \ + && rm ${DSE_HOME}/resources/cassandra/lib/netty*linux-x86* + +FROM --platform=$BUILDPLATFORM dse-server-base-${TARGETARCH} AS dse-server-base #############################################################