@@ -11,32 +11,40 @@ ARG TARGETARCH
1111ARG TARGETOS
1212ARG STACKABLE_USER_UID
1313
14+ WORKDIR /stackable
15+
16+ COPY --chown=${STACKABLE_USER_UID}:0 shared/protobuf/stackable/patches/patchable.toml /stackable/src/shared/protobuf/stackable/patches/patchable.toml
17+ COPY --chown=${STACKABLE_USER_UID}:0 shared/protobuf/stackable/patches/${PROTOBUF} /stackable/src/shared/protobuf/stackable/patches/${PROTOBUF}
18+
19+ RUN <<EOF
20+ rpm --install --replacepkgs https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
21+ microdnf update
22+ # boost is a build dependency starting in Hadoop 3.4.0 if compiling native code
23+ # automake and are required to build protobuf
24+ microdnf install boost1.78-devel automake libtool
25+ microdnf clean all
26+ rm -rf /var/cache/yum
27+ EOF
28+
1429# This Protobuf version is the exact version as used in the Hadoop Dockerfile
1530# See https://github.com/apache/hadoop/blob/trunk/dev-support/docker/pkg-resolver/install-protobuf.sh
1631# (this was hardcoded in the Dockerfile in earlier versions of Hadoop, make sure to look at the exact version in Github)
17- WORKDIR /opt/protobuf-src
1832RUN <<EOF
19- curl https://repo.stackable.tech/repository/packages/protobuf/protobuf-java-${PROTOBUF}.tar.gz -o /opt/protobuf.tar.gz
20- tar xzf /opt/protobuf.tar.gz --strip-components 1 --no-same-owner
33+ cd "$(/stackable/patchable --images-repo-root=src checkout shared/protobuf ${PROTOBUF})"
34+
35+ # Create snapshot of the source code including custom patches
36+ tar -czf /stackable/protobuf-${PROTOBUF}-src.tar.gz .
37+
38+ ./autogen.sh
2139 ./configure --prefix=/opt/protobuf
2240 make "-j$(nproc)"
2341 make install
24- rm -rf /opt/protobuf-src
42+ (cd .. && rm -r ${PROTOBUF})
2543EOF
2644
2745ENV PROTOBUF_HOME=/opt/protobuf
2846ENV PATH="${PATH}:/opt/protobuf/bin"
2947
30- RUN <<EOF
31- rpm --install --replacepkgs https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
32- microdnf update
33- # boost is a build dependency starting in Hadoop 3.4.0 if compiling native code
34- microdnf install boost1.78-devel
35- microdnf clean all
36- rm -rf /var/cache/yum
37- EOF
38-
39- WORKDIR /stackable
4048RUN <<EOF
4149# async-profiler
4250ARCH="${TARGETARCH/amd64/x64}"
@@ -63,6 +71,9 @@ COPY --chown=${STACKABLE_USER_UID}:0 hadoop/stackable/jmx /stackable/jmx
6371RUN <<EOF
6472cd "$(/stackable/patchable --images-repo-root=src checkout hadoop ${PRODUCT})"
6573
74+ # Create snapshot of the source code including custom patches
75+ tar -czf /stackable/hadoop-${PRODUCT}-src.tar.gz .
76+
6677mvn \
6778 --batch-mode \
6879 --no-transfer-progress \
@@ -125,14 +136,20 @@ EOF
125136ENV JAVA_HOME="/usr/lib/jvm/temurin-17-jdk"
126137
127138USER ${STACKABLE_USER_UID}
128- WORKDIR /build
139+ WORKDIR /stackable
140+
141+ COPY --chown=${STACKABLE_USER_UID}:0 hadoop/hdfs-utils/stackable/patches/patchable.toml /stackable/src/hadoop/hdfs-utils/stackable/patches/patchable.toml
142+ COPY --chown=${STACKABLE_USER_UID}:0 hadoop/hdfs-utils/stackable/patches/${HDFS_UTILS} /stackable/src/hadoop/hdfs-utils/stackable/patches/${HDFS_UTILS}
143+
129144# The Stackable HDFS utils contain an OPA authorizer, group mapper & topology provider.
130145# The topology provider provides rack awareness functionality for HDFS by allowing users to specify Kubernetes
131146# labels to build a rackID from.
132147# Starting with hdfs-utils version 0.3.0 the topology provider is not a standalone jar anymore and included in hdfs-utils.
133148RUN <<EOF
134- curl "https://github.com/stackabletech/hdfs-utils/archive/refs/tags/v${HDFS_UTILS}.tar.gz" | tar -xzC .
135- cd hdfs-utils-${HDFS_UTILS}
149+ cd "$(/stackable/patchable --images-repo-root=src checkout hadoop/hdfs-utils ${HDFS_UTILS})"
150+
151+ # Create snapshot of the source code including custom patches
152+ tar -czf /stackable/hdfs-utils-${HDFS_UTILS}-src.tar.gz .
136153
137154mvn \
138155 --batch-mode \
@@ -147,7 +164,7 @@ cp target/hdfs-utils-$HDFS_UTILS.jar /stackable/hdfs-utils-${HDFS_UTILS}.jar
147164rm -rf hdfs-utils-main
148165
149166# Set correct groups
150- chmod g=u /stackable/hdfs-utils-${HDFS_UTILS}.jar
167+ chmod g=u /stackable/hdfs-utils-${HDFS_UTILS}.jar /stackable/hdfs-utils-${HDFS_UTILS}-src.tar.gz
151168EOF
152169
153170FROM stackable/image/java-base AS final
@@ -168,6 +185,7 @@ LABEL \
168185
169186COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-builder /stackable /stackable
170187COPY --chown=${STACKABLE_USER_UID}:0 --from=hdfs-utils-builder /stackable/hdfs-utils-${HDFS_UTILS}.jar /stackable/hadoop-${PRODUCT}/share/hadoop/common/lib/hdfs-utils-${HDFS_UTILS}.jar
188+ COPY --chown=${STACKABLE_USER_UID}:0 --from=hdfs-utils-builder /stackable/hdfs-utils-${HDFS_UTILS}-src.tar.gz /stackable
171189
172190COPY --chown=${STACKABLE_USER_UID}:0 hadoop/licenses /licenses
173191
0 commit comments