11# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
22# check=error=true
33
4+ FROM stackable/image/hadoop AS hadoop-builder
5+
46FROM stackable/image/java-devel AS druid-builder
57
68ARG PRODUCT
9+ ARG RELEASE
710ARG JACKSON_DATAFORMAT_XML
811ARG STAX2_API
912ARG WOODSTOX_CORE
1013ARG AUTHORIZER
1114ARG STACKABLE_USER_UID
15+ ARG HADOOP
1216
1317# Setting this to anything other than "true" will keep the cache folders around (e.g. for Maven, NPM etc.)
1418# This can be used to speed up builds when disk space is of no concern.
@@ -35,6 +39,7 @@ WORKDIR /stackable
3539COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/patches/patchable.toml /stackable/src/druid/stackable/patches/patchable.toml
3640COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/patches/${PRODUCT} /stackable/src/druid/stackable/patches/${PRODUCT}
3741
42+ COPY --from=hadoop-builder --chown=${STACKABLE_USER_UID}:0 /stackable/patched-libs /stackable/patched-libs
3843# Cache mounts are owned by root by default
3944# We need to explicitly give the uid to use which is hardcoded to "1000" in stackable-base
4045# The cache id has to include the product version that we are building because otherwise
@@ -54,24 +59,33 @@ RUN --mount=type=cache,id=maven-${PRODUCT},uid=${STACKABLE_USER_UID},target=/sta
5459cd "$(cat /tmp/DRUID_SOURCE_DIR)" || exit 1
5560rm /tmp/DRUID_SOURCE_DIR
5661
62+ ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
63+ NEW_VERSION="${PRODUCT}-stackable${RELEASE}"
64+
65+ mvn versions:set -DnewVersion=$NEW_VERSION
66+
67+ # Make Maven aware of custom Stackable libraries
68+ cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
69+
5770# Create snapshot of the source code including custom patches
58- tar -czf /stackable/druid-${PRODUCT }-src.tar.gz .
71+ tar -czf /stackable/druid-${NEW_VERSION }-src.tar.gz .
5972
6073mvn \
6174 --batch-mode \
6275 --no-transfer-progress \
6376 clean install \
6477 -Pdist,stackable-bundle-contrib-exts \
65- -Dmaven.test.skip `# Skip test compilation` \
78+ -Dhadoop.compile.version=${HADOOP}-stackable${RELEASE} \
6679 -DskipTests `# Skip test execution` \
6780 -Dcheckstyle.skip `# Skip checkstyle checks. We dont care if the code is properly formatted, it just wastes time` \
6881 -Dmaven.javadoc.skip=true `# Dont generate javadoc` \
6982 -Dmaven.gitcommitid.skip=true `# The gitcommitid plugin cannot work with git workspaces (ie: patchable)` \
7083 $(if [[ ${PRODUCT} != 30.* ]]; then echo --projects '!quidem-ut' ; fi) `# This is just a maven module for tests. https://github.com/apache/druid/pull/16867 added https://raw.githubusercontent.com/kgyrtkirk/datasets/repo/ as a Maven repository, which fails to pull for us (Failed to execute goal on project druid-quidem-ut: Could not resolve dependencies for project org.apache.druid:druid-quidem-ut:jar:33.0.0: com.github.kgyrtkirk.datasets:kttm-nested:jar:0.1 was not found in https://build-repo.stackable.tech/repository/maven-public/). By disabling the maven module we dont pull in this weird dependency...`
7184
72- mv distribution/target/apache-druid-${PRODUCT}-bin/apache-druid-${PRODUCT} /stackable/
73- mv distribution/target/bom.json /stackable/apache-druid-${PRODUCT}/apache-druid-${PRODUCT}.cdx.json
74- rm -rf /stackable/apache-druid-${PRODUCT}-src
85+ mv distribution/target/apache-druid-${NEW_VERSION}-bin/apache-druid-${NEW_VERSION} /stackable/
86+ sed -i "s/${NEW_VERSION}/${ORIGINAL_VERSION}/g" distribution/target/bom.json
87+ mv distribution/target/bom.json /stackable/apache-druid-${NEW_VERSION}/apache-druid-${NEW_VERSION}.cdx.json
88+ rm -rf /stackable/apache-druid-${NEW_VERSION}-src
7589
7690# We're removing these to make the intermediate layer smaller
7791# This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
@@ -83,11 +97,11 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
8397 rm -rf /stackable/.cache/*
8498fi
8599
86- # Do not remove the /stackable/apache-druid-${PRODUCT }/quickstart folder, it is needed for loading the Wikipedia
100+ # Do not remove the /stackable/apache-druid-${NEW_VERSION }/quickstart folder, it is needed for loading the Wikipedia
87101# testdata in kuttl tests and the getting started guide.
88102
89103# Install OPA authorizer extension.
90- curl "https://repo.stackable.tech/repository/packages/druid/druid-opa-authorizer-${AUTHORIZER}.tar.gz" | tar -xzC /stackable/apache-druid-${PRODUCT }/extensions
104+ curl "https://repo.stackable.tech/repository/packages/druid/druid-opa-authorizer-${AUTHORIZER}.tar.gz" | tar -xzC /stackable/apache-druid-${NEW_VERSION }/extensions
91105
92106# change groups
93107chmod -R g=u /stackable
@@ -122,8 +136,8 @@ LABEL io.k8s.description="${DESCRIPTION}"
122136LABEL io.k8s.display-name="${NAME}"
123137
124138
125- COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/apache-druid-${PRODUCT} /stackable/apache-druid-${PRODUCT}
126- COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/druid-${PRODUCT}-src.tar.gz /stackable
139+ COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/apache-druid-${PRODUCT}-stackable${RELEASE} /stackable/apache-druid-${PRODUCT}-stackable${RELEASE }
140+ COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/druid-${PRODUCT}-stackable${RELEASE}- src.tar.gz /stackable
127141
128142COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/bin /stackable/bin
129143COPY --chown=${STACKABLE_USER_UID}:0 druid/licenses /licenses
@@ -136,7 +150,7 @@ chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
136150chmod g=u /stackable/package_manifest.txt
137151rm -rf /var/cache/yum
138152
139- ln -sf /stackable/apache-druid-${PRODUCT} /stackable/druid
153+ ln -sf /stackable/apache-druid-${PRODUCT}-stackable${RELEASE} /stackable/druid
140154chown -h ${STACKABLE_USER_UID}:0 stackable/druid
141155
142156# Force to overwrite the existing 'run-druid'
@@ -145,7 +159,7 @@ chown -h ${STACKABLE_USER_UID}:0 /stackable/druid/bin/run-druid
145159
146160# fix missing permissions
147161chmod -R g=u /stackable/bin
148- chmod g=u /stackable/apache-druid-${PRODUCT}
162+ chmod g=u /stackable/apache-druid-${PRODUCT}-stackable${RELEASE} /stackable/druid-${PRODUCT}-stackable${RELEASE}-src.tar.gz
149163EOF
150164
151165# ----------------------------------------
0 commit comments