11# syntax=docker/dockerfile:1.10.0@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5
22# check=error=true
33
4- FROM stackable/image/hadoop AS hadoop-builder
5-
64FROM stackable/image/java-devel AS hbase-builder
75
86ARG PRODUCT
9- ARG HBASE_OPERATOR_TOOLS
7+ ARG HBASE_HBASE_OPERATOR_TOOLS
108ARG ASYNC_PROFILER
11- ARG PHOENIX
129ARG HBASE_PROFILE
1310ARG HADOOP
1411ARG TARGETARCH
9592chmod --recursive g=u /stackable
9693EOF
9794
98-
99- FROM stackable/image/java-devel AS opa-authorizer-builder
100-
101- ARG PRODUCT
102- ARG OPA_AUTHORIZER
103- ARG DELETE_CACHES
104- ARG STACKABLE_USER_UID
105-
106- USER ${STACKABLE_USER_UID}
107- WORKDIR /stackable
108-
109- # Use the product version as cache id "maven-opa-${PRODUCT}" to avoid the "rm -rf" problem described above.
110- # Using the OPA_AUTHORIZER arg is not unique if the same version is used for multiple products.
111- RUN --mount=type=cache,id=maven-opa-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
112- # ##
113- # ## OPA Authorizer (only for 2.6 upwards)
114- # ##
115- if [[ -n "$OPA_AUTHORIZER" ]]; then
116- git clone --depth 1 --branch "$OPA_AUTHORIZER" https://github.com/stackabletech/hbase-opa-authorizer.git
117- mvn \
118- --batch-mode \
119- --no-transfer-progress \
120- -DskipTests \
121- -Dmaven.test.skip=true \
122- -fhbase-opa-authorizer \
123- package
124- else
125- # Create a dummy jar to avoid errors when copying it the final image
126- mkdir -p hbase-opa-authorizer/target
127- touch hbase-opa-authorizer/target/hbase-opa-authorizer.jar
128- fi
129-
130- if [ "${DELETE_CACHES}" = "true" ] ; then
131- rm -rf /stackable/.m2/repository/*
132- fi
133-
134- # set correct groups
135- chmod --recursive g=u /stackable
136- EOF
137-
138-
139- FROM stackable/image/java-devel AS hbase-operator-tools-builder
140-
141- ARG HBASE_OPERATOR_TOOLS
142- ARG HBASE_THIRDPARTY
143- ARG PRODUCT
144- ARG STACKABLE_USER_UID
145-
146- # Setting this to anything other than "true" will keep the cache folders around (e.g. for Maven, NPM etc.)
147- # This can be used to speed up builds when disk space is of no concern.
148- ARG DELETE_CACHES="true"
149-
150- # Resolve paths in bin/hbck2
151- # The variable names are intentionally passed to envsubst in single-quotes,
152- # so that they are not expanded. Disabling ShellCheck rules in a Dockerfile
153- # does not work, so please ignore the according warning (SC2016).
154- COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbck2.env /stackable/bin/
155- COPY --chown=${STACKABLE_USER_UID}:0 hbase/hbase-operator-tools/stackable/patches/patchable.toml /stackable/src/hbase-operator-tools/stackable/patches/patchable.toml
156- COPY --chown=${STACKABLE_USER_UID}:0 hbase/hbase-operator-tools/stackable/patches/${HBASE_OPERATOR_TOOLS} /stackable/src/hbase-operator-tools/stackable/patches/${HBASE_OPERATOR_TOOLS}
157- COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbase-entrypoint.sh /stackable/bin/
158-
159- USER ${STACKABLE_USER_UID}
160- WORKDIR /stackable
161-
162- # Cache mounts are owned by root by default
163- # We need to explicitly give the uid to use
164- RUN --mount=type=cache,id=maven-hbase-operator-tools-${HBASE_OPERATOR_TOOLS},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
165- cd "$(/stackable/patchable --images-repo-root=src checkout hbase-operator-tools ${HBASE_OPERATOR_TOOLS})"
166-
167- mvn \
168- --batch-mode \
169- --no-transfer-progress \
170- -Dhbase.version=${PRODUCT} \
171- -Dhbase-thirdparty.version=${HBASE_THIRDPARTY} \
172- -DskipTests \
173- -Dmaven.test.skip=true \
174- package assembly:single
175-
176- # We need the "*" here as the directory won't be the same as the final tar file for SNAPSHOTs which we currently have to use for 2.6
177- # And we're stripping the top level directory while extracting because it may be called different than the folder name when it's a SNAPSHOT
178- mkdir /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}
179- tar -xz \
180- -f hbase-operator-tools-assembly/target/hbase-operator-tools-*-bin.tar.gz \
181- -C /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}/ \
182- --strip-components=1
183- mv hbase-operator-tools-assembly/target/bom.json /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}.cdx.json
184- (cd .. && rm -r ${HBASE_OPERATOR_TOOLS})
185-
186- envsubst '${PRODUCT}:${HBASE_OPERATOR_TOOLS}' < /stackable/bin/hbck2.env > /stackable/bin/hbck2
187- chmod +x /stackable/bin/hbck2
188- rm /stackable/bin/hbck2.env
189-
190- # We're removing these to make the intermediate layer smaller
191- # This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
192- # and we are sometimes running into errors because we're out of space.
193- # Therefore, we try to clean up all layers as much as possible.
194- if [ "${DELETE_CACHES}" = "true" ] ; then
195- rm -rf /stackable/.m2/repository/*
196- rm -rf /stackable/.npm/*
197- rm -rf /stackable/.cache/*
198- fi
199-
200- # set correct groups
201- chmod --recursive g=u /stackable
202- EOF
203-
204-
20595# Splitting this out into its own builder so that Hadoop & HBase can be built in parallel
20696# envsubst is only available in java-devel which is why we don't just do this in the final image
20797FROM stackable/image/java-devel AS hadoop-s3-builder
@@ -213,7 +103,7 @@ ARG STACKABLE_USER_UID
213103USER ${STACKABLE_USER_UID}
214104WORKDIR /stackable
215105
216- COPY --from=hadoop-builder --chown=${STACKABLE_USER_UID}:0 \
106+ COPY --from=stackable/image/ hadoop --chown=${STACKABLE_USER_UID}:0 \
217107 # The artifact name of the AWS bundle has changed between Haddop 3.3.6 and 3.4.1
218108 # from aws-java-sdk-bundle-*.jar to bundle-*.jar.
219109 # See: https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/aws_sdk_upgrade.html
@@ -240,76 +130,14 @@ rm /stackable/bin/export-snapshot-to-s3.env
240130chmod --recursive g=u /stackable
241131EOF
242132
243-
244- FROM stackable/image/java-devel AS phoenix-builder
245-
246- ARG PRODUCT
247- ARG ASYNC_PROFILER
248- ARG PHOENIX
249- ARG HBASE_PROFILE
250- ARG HADOOP
251- ARG STACKABLE_USER_UID
252-
253- # Setting this to anything other than "true" will keep the cache folders around (e.g. for Maven, NPM etc.)
254- # This can be used to speed up builds when disk space is of no concern.
255- ARG DELETE_CACHES="true"
256-
257- COPY --chown=${STACKABLE_USER_UID}:0 hbase/phoenix/stackable/patches/patchable.toml /stackable/src/phoenix/stackable/patches/patchable.toml
258- COPY --chown=${STACKABLE_USER_UID}:0 hbase/phoenix/stackable/patches/${PHOENIX} /stackable/src/phoenix/stackable/patches/${PHOENIX}
259- USER ${STACKABLE_USER_UID}
260- WORKDIR /stackable
261-
262- RUN --mount=type=cache,id=maven-phoenix-${PHOENIX}-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
263- cd "$(/stackable/patchable --images-repo-root=src checkout phoenix ${PHOENIX})"
264-
265- # The Maven command can be found inside of the scripts in the create-release folder (release-util.sh as of Phoenix 5.2.0)
266- # https://github.com/apache/phoenix/tree/5.2.0/dev/create-release
267- mvn \
268- --batch-mode \
269- --no-transfer-progress \
270- -Dhbase.version=${PRODUCT} \
271- -Dhbase.profile=${HBASE_PROFILE} \
272- -Dhadoop.version=${HADOOP} \
273- -DskipTests \
274- -Dmaven.test.skip=true \
275- -Dcheckstyle.skip=true \
276- clean \
277- package
278-
279- # We need the "*" here as the directory won't be the same as the final tar file for SNAPSHOTs which we currently have to use for 2.6
280- # And we're stripping the top level directory while extracting because it may be called different than the folder name when it's a SNAPSHOT
281- mkdir /stackable/phoenix-${HBASE_PROFILE}-${PHOENIX}-bin
282- tar -xz -f phoenix-assembly/target/phoenix-hbase-*-bin.tar.gz -C /stackable/phoenix-${HBASE_PROFILE}-${PHOENIX}-bin/ --strip-components=1
283- mv phoenix-assembly/target/bom.json /stackable/phoenix-${HBASE_PROFILE}-${PHOENIX}-bin/phoenix-${HBASE_PROFILE}-${PHOENIX}.cdx.json
284-
285- # Remove sources
286- (cd .. && rm -r ${PHOENIX})
287- ln -s "/stackable/phoenix-${HBASE_PROFILE}-${PHOENIX}-bin" /stackable/phoenix
288-
289- # We're removing these to make the intermediate layer smaller
290- # This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
291- # and we are sometimes running into errors because we're out of space.
292- # Therefore, we try to clean up all layers as much as possible.
293- if [ "${DELETE_CACHES}" = "true" ] ; then
294- rm -rf /stackable/.m2/repository/*
295- rm -rf /stackable/.npm/*
296- rm -rf /stackable/.cache/*
297- fi
298-
299- # set correct groups
300- chmod --recursive g=u /stackable
301- EOF
302-
303-
304133# Final Image
305134FROM stackable/image/java-base AS final
306135
307136ARG PRODUCT
308137ARG RELEASE
309138ARG HADOOP
310- ARG PHOENIX
311139ARG HBASE_PROFILE
312- ARG HBASE_OPERATOR_TOOLS
140+ ARG HBASE_HBASE_OPERATOR_TOOLS
313141ARG STACKABLE_USER_UID
314142
315143ARG NAME="Apache HBase"
@@ -337,11 +165,11 @@ LABEL io.k8s.display-name="${NAME}"
337165COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-builder /stackable/hbase-${PRODUCT} /stackable/hbase-${PRODUCT}/
338166COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-builder /stackable/async-profiler /stackable/async-profiler/
339167
340- COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-operator-tools-builder /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS } /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS }/
341- COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-operator-tools-builder /stackable/bin/hbck2 /stackable/bin/hbck2
342- COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-operator-tools-builder /stackable/bin/hbase-entrypoint.sh /stackable/hbase-${PRODUCT}/bin/hbase-entrypoint.sh
168+ COPY --chown=${STACKABLE_USER_UID}:0 --from=stackable/image/ hbase/hbase -operator-tools /stackable/hbase-operator-tools-${HBASE_HBASE_OPERATOR_TOOLS } /stackable/hbase-operator-tools-${HBASE_HBASE_OPERATOR_TOOLS }/
169+ COPY --chown=${STACKABLE_USER_UID}:0 --from=stackable/image/ hbase/hbase -operator-tools /stackable/bin/hbck2 /stackable/bin/hbck2
170+ COPY --chown=${STACKABLE_USER_UID}:0 --from=stackable/image/ hbase/hbase -operator-tools /stackable/bin/hbase-entrypoint.sh /stackable/hbase-${PRODUCT}/bin/hbase-entrypoint.sh
343171
344- COPY --chown=${STACKABLE_USER_UID}:0 --from=phoenix-builder /stackable/phoenix /stackable/phoenix/
172+ COPY --chown=${STACKABLE_USER_UID}:0 --from=stackable/image/hbase/ phoenix /stackable/phoenix /stackable/phoenix/
345173
346174COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-s3-builder /stackable/bin/export-snapshot-to-s3 /stackable/bin/export-snapshot-to-s3
347175COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-s3-builder /stackable/hadoop/share/hadoop/tools/lib/ /stackable/hadoop/share/hadoop/tools/lib/
@@ -350,11 +178,11 @@ COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-s3-builder /stackable/hadoop/
350178# Storage (ADLS) to /stackable/hbase-${PRODUCT}/lib which is on the classpath.
351179# hadoop-azure-${HADOOP}.jar contains the AzureBlobFileSystem which is required
352180# by hadoop-common-${HADOOP}.jar if the scheme of a file system is "abfs://".
353- COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-builder \
181+ COPY --chown=${STACKABLE_USER_UID}:0 --from=stackable/image/ hadoop \
354182 /stackable/hadoop/share/hadoop/tools/lib/hadoop-azure-${HADOOP}.jar \
355183 /stackable/hbase-${PRODUCT}/lib/
356184
357- COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/hbase-opa-authorizer/target/hbase-opa-authorizer*.jar /stackable/hbase-${PRODUCT}/lib
185+ COPY --chown=${STACKABLE_USER_UID}:0 --from=stackable/image/hbase/hbase- opa-authorizer /stackable/hbase-opa-authorizer/target/hbase-opa-authorizer*.jar /stackable/hbase-${PRODUCT}/lib
358186
359187RUN <<EOF
360188microdnf update
@@ -378,7 +206,7 @@ ln --symbolic --logical --verbose "/stackable/hbase-${PRODUCT}" /stackable/hbase
378206chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase
379207chmod g=u /stackable/hbase
380208
381- ln --symbolic --logical --verbose "/stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS }" /stackable/hbase-operator-tools
209+ ln --symbolic --logical --verbose "/stackable/hbase-operator-tools-${HBASE_HBASE_OPERATOR_TOOLS }" /stackable/hbase-operator-tools
382210chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase-operator-tools
383211chmod g=u /stackable/hbase-operator-tools
384212
0 commit comments