Skip to content

Commit 3d9502d

Browse files
committed
feat: separate Dockerfiles for Phoenix, hbase-operator-tools and hbase-opa-authorizer
1 parent 485cb06 commit 3d9502d

File tree

9 files changed

+215
-194
lines changed

9 files changed

+215
-194
lines changed

conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
druid = importlib.import_module("druid.versions")
1515
hadoop = importlib.import_module("hadoop.versions")
1616
hbase = importlib.import_module("hbase.versions")
17+
hbase_phoenix = importlib.import_module("hbase.phoenix.versions")
18+
hbase_opa_authorizer = importlib.import_module("hbase.hbase-opa-authorizer.versions")
19+
hbase_operator_tools = importlib.import_module("hbase.hbase-operator-tools.versions")
1720
hello_world = importlib.import_module("hello-world.versions")
1821
hive = importlib.import_module("hive.versions")
1922
java_base = importlib.import_module("java-base.versions")
@@ -45,6 +48,9 @@
4548
{"name": "druid", "versions": druid.versions},
4649
{"name": "hadoop", "versions": hadoop.versions},
4750
{"name": "hbase", "versions": hbase.versions},
51+
{"name": "hbase/phoenix", "versions": hbase_phoenix.versions},
52+
{"name": "hbase/hbase-opa-authorizer", "versions": hbase_opa_authorizer.versions},
53+
{"name": "hbase/hbase-operator-tools", "versions": hbase_operator_tools.versions},
4854
{"name": "hello-world", "versions": hello_world.versions},
4955
{"name": "hive", "versions": hive.versions},
5056
{"name": "java-base", "versions": java_base.versions},

hbase/Dockerfile

Lines changed: 10 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
# syntax=docker/dockerfile:1.10.0@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5
22
# check=error=true
33

4-
FROM stackable/image/hadoop AS hadoop-builder
5-
64
FROM stackable/image/java-devel AS hbase-builder
75

86
ARG PRODUCT
9-
ARG HBASE_OPERATOR_TOOLS
7+
ARG HBASE_HBASE_OPERATOR_TOOLS
108
ARG ASYNC_PROFILER
11-
ARG PHOENIX
129
ARG HBASE_PROFILE
1310
ARG HADOOP
1411
ARG TARGETARCH
@@ -95,113 +92,6 @@ fi
9592
chmod --recursive g=u /stackable
9693
EOF
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
20797
FROM stackable/image/java-devel AS hadoop-s3-builder
@@ -213,7 +103,7 @@ ARG STACKABLE_USER_UID
213103
USER ${STACKABLE_USER_UID}
214104
WORKDIR /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
240130
chmod --recursive g=u /stackable
241131
EOF
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
305134
FROM stackable/image/java-base AS final
306135

307136
ARG PRODUCT
308137
ARG RELEASE
309138
ARG HADOOP
310-
ARG PHOENIX
311139
ARG HBASE_PROFILE
312-
ARG HBASE_OPERATOR_TOOLS
140+
ARG HBASE_HBASE_OPERATOR_TOOLS
313141
ARG STACKABLE_USER_UID
314142

315143
ARG NAME="Apache HBase"
@@ -337,11 +165,11 @@ LABEL io.k8s.display-name="${NAME}"
337165
COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-builder /stackable/hbase-${PRODUCT} /stackable/hbase-${PRODUCT}/
338166
COPY --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

346174
COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-s3-builder /stackable/bin/export-snapshot-to-s3 /stackable/bin/export-snapshot-to-s3
347175
COPY --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

359187
RUN <<EOF
360188
microdnf update
@@ -378,7 +206,7 @@ ln --symbolic --logical --verbose "/stackable/hbase-${PRODUCT}" /stackable/hbase
378206
chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase
379207
chmod 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
382210
chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase-operator-tools
383211
chmod g=u /stackable/hbase-operator-tools
384212

hbase/hbase-opa-authorizer/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM stackable/image/java-devel
2+
3+
ARG PRODUCT
4+
ARG DELETE_CACHES
5+
ARG STACKABLE_USER_UID
6+
7+
USER ${STACKABLE_USER_UID}
8+
WORKDIR /stackable
9+
10+
RUN --mount=type=cache,id=maven-opa,uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
11+
###
12+
### OPA Authorizer (only for 2.6 upwards)
13+
###
14+
if [[ -n "$PRODUCT" ]]; then
15+
git clone --depth 1 --branch "$PRODUCT" https://github.com/stackabletech/hbase-opa-authorizer.git
16+
mvn \
17+
--batch-mode \
18+
--no-transfer-progress \
19+
-DskipTests \
20+
-Dmaven.test.skip=true \
21+
-fhbase-opa-authorizer \
22+
package
23+
else
24+
# Create a dummy jar to avoid errors when copying it the final image
25+
mkdir -p hbase-opa-authorizer/target
26+
touch hbase-opa-authorizer/target/hbase-opa-authorizer.jar
27+
fi
28+
29+
if [ "${DELETE_CACHES}" = "true" ] ; then
30+
rm -rf /stackable/.m2/repository/*
31+
fi
32+
33+
# set correct groups
34+
chmod --recursive g=u /stackable
35+
EOF
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
versions = [
2+
{
3+
"product": "0.1.0",
4+
"java-devel": "11",
5+
"delete_caches": "true",
6+
},
7+
]

hbase/hbase-operator-tools/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM stackable/image/java-devel
2+
3+
ARG PRODUCT
4+
ARG HBASE_THIRDPARTY
5+
ARG HBASE_VERSION
6+
ARG STACKABLE_USER_UID
7+
8+
# Setting this to anything other than "true" will keep the cache folders around (e.g. for Maven, NPM etc.)
9+
# This can be used to speed up builds when disk space is of no concern.
10+
ARG DELETE_CACHES="true"
11+
12+
# Resolve paths in bin/hbck2
13+
# The variable names are intentionally passed to envsubst in single-quotes,
14+
# so that they are not expanded. Disabling ShellCheck rules in a Dockerfile
15+
# does not work, so please ignore the according warning (SC2016).
16+
COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbck2.env /stackable/bin/
17+
COPY --chown=${STACKABLE_USER_UID}:0 hbase/hbase-operator-tools/stackable/patches/patchable.toml /stackable/src/hbase-operator-tools/stackable/patches/patchable.toml
18+
COPY --chown=${STACKABLE_USER_UID}:0 hbase/hbase-operator-tools/stackable/patches/${PRODUCT} /stackable/src/hbase-operator-tools/stackable/patches/${PRODUCT}
19+
COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbase-entrypoint.sh /stackable/bin/
20+
21+
USER ${STACKABLE_USER_UID}
22+
WORKDIR /stackable
23+
24+
# Cache mounts are owned by root by default
25+
# We need to explicitly give the uid to use
26+
RUN --mount=type=cache,id=maven-hbase-operator-tools-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
27+
cd "$(/stackable/patchable --images-repo-root=src checkout hbase-operator-tools ${PRODUCT})"
28+
29+
mvn \
30+
--batch-mode \
31+
--no-transfer-progress \
32+
-Dhbase.version=${HBASE_VERSION} \
33+
-Dhbase-thirdparty.version=${HBASE_THIRDPARTY} \
34+
-DskipTests \
35+
-Dmaven.test.skip=true \
36+
package assembly:single
37+
38+
# 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
39+
# 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
40+
mkdir /stackable/hbase-operator-tools-${PRODUCT}
41+
tar -xz \
42+
-f hbase-operator-tools-assembly/target/hbase-operator-tools-*-bin.tar.gz \
43+
-C /stackable/hbase-operator-tools-${PRODUCT}/ \
44+
--strip-components=1
45+
mv hbase-operator-tools-assembly/target/bom.json /stackable/hbase-operator-tools-${PRODUCT}/hbase-operator-tools-${PRODUCT}.cdx.json
46+
(cd .. && rm -r ${PRODUCT})
47+
48+
envsubst '${PRODUCT}:${PRODUCT}' < /stackable/bin/hbck2.env > /stackable/bin/hbck2
49+
chmod +x /stackable/bin/hbck2
50+
rm /stackable/bin/hbck2.env
51+
52+
# We're removing these to make the intermediate layer smaller
53+
# This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
54+
# and we are sometimes running into errors because we're out of space.
55+
# Therefore, we try to clean up all layers as much as possible.
56+
if [ "${DELETE_CACHES}" = "true" ] ; then
57+
rm -rf /stackable/.m2/repository/*
58+
rm -rf /stackable/.npm/*
59+
rm -rf /stackable/.cache/*
60+
fi
61+
62+
# set correct groups
63+
chmod --recursive g=u /stackable
64+
EOF

0 commit comments

Comments
 (0)