1
1
# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
2
2
# check=error=true
3
3
4
+ FROM stackable/image/hadoop AS hadoop-builder
5
+
4
6
FROM stackable/image/java-devel AS druid-builder
5
7
6
8
ARG PRODUCT
9
+ ARG RELEASE
7
10
ARG JACKSON_DATAFORMAT_XML
8
11
ARG STAX2_API
9
12
ARG WOODSTOX_CORE
10
13
ARG AUTHORIZER
11
14
ARG STACKABLE_USER_UID
15
+ ARG HADOOP
12
16
13
17
# Setting this to anything other than "true" will keep the cache folders around (e.g. for Maven, NPM etc.)
14
18
# This can be used to speed up builds when disk space is of no concern.
@@ -35,6 +39,7 @@ WORKDIR /stackable
35
39
COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/patches/patchable.toml /stackable/src/druid/stackable/patches/patchable.toml
36
40
COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/patches/${PRODUCT} /stackable/src/druid/stackable/patches/${PRODUCT}
37
41
42
+ COPY --from=hadoop-builder --chown=${STACKABLE_USER_UID}:0 /stackable/patched-libs /stackable/patched-libs
38
43
# Cache mounts are owned by root by default
39
44
# We need to explicitly give the uid to use which is hardcoded to "1000" in stackable-base
40
45
# 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
54
59
cd "$(cat /tmp/DRUID_SOURCE_DIR)" || exit 1
55
60
rm /tmp/DRUID_SOURCE_DIR
56
61
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
+
57
70
# 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 .
59
72
60
73
mvn \
61
74
--batch-mode \
62
75
--no-transfer-progress \
63
76
clean install \
64
77
-Pdist,stackable-bundle-contrib-exts \
65
- -Dmaven.test.skip `# Skip test compilation` \
78
+ -Dhadoop.compile.version=${HADOOP}-stackable${RELEASE} \
66
79
-DskipTests `# Skip test execution` \
67
80
-Dcheckstyle.skip `# Skip checkstyle checks. We dont care if the code is properly formatted, it just wastes time` \
68
81
-Dmaven.javadoc.skip=true `# Dont generate javadoc` \
69
82
-Dmaven.gitcommitid.skip=true `# The gitcommitid plugin cannot work with git workspaces (ie: patchable)` \
70
83
$(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...`
71
84
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
75
89
76
90
# We're removing these to make the intermediate layer smaller
77
91
# 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
83
97
rm -rf /stackable/.cache/*
84
98
fi
85
99
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
87
101
# testdata in kuttl tests and the getting started guide.
88
102
89
103
# 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
91
105
92
106
# change groups
93
107
chmod -R g=u /stackable
@@ -122,8 +136,8 @@ LABEL io.k8s.description="${DESCRIPTION}"
122
136
LABEL io.k8s.display-name="${NAME}"
123
137
124
138
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
127
141
128
142
COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/bin /stackable/bin
129
143
COPY --chown=${STACKABLE_USER_UID}:0 druid/licenses /licenses
@@ -136,7 +150,7 @@ chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
136
150
chmod g=u /stackable/package_manifest.txt
137
151
rm -rf /var/cache/yum
138
152
139
- ln -sf /stackable/apache-druid-${PRODUCT} /stackable/druid
153
+ ln -sf /stackable/apache-druid-${PRODUCT}-stackable${RELEASE} /stackable/druid
140
154
chown -h ${STACKABLE_USER_UID}:0 stackable/druid
141
155
142
156
# Force to overwrite the existing 'run-druid'
@@ -145,7 +159,7 @@ chown -h ${STACKABLE_USER_UID}:0 /stackable/druid/bin/run-druid
145
159
146
160
# fix missing permissions
147
161
chmod -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
149
163
EOF
150
164
151
165
# ----------------------------------------
0 commit comments