@@ -65,7 +65,7 @@ ln -s "/stackable/hbase-${PRODUCT}" /stackable/hbase
65
65
# ## JMX Prometheus Exporter/Agent
66
66
# ##
67
67
if [[ -n "${JMX_EXPORTER}" ]] ; then
68
- curl "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" -o "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"
68
+ curl --fail "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" -o "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"
69
69
chmod +x "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"
70
70
ln -s "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" /stackable/jmx/jmx_prometheus_javaagent.jar
71
71
fi
75
75
# ##
76
76
cd /stackable
77
77
export ARCH="${TARGETARCH/amd64/x64}"
78
- curl "https://repo.stackable.tech/repository/packages/async-profiler/async-profiler-${ASYNC_PROFILER}-${TARGETOS}-${ARCH}.tar.gz" | tar -xzC .
78
+ curl --fail "https://repo.stackable.tech/repository/packages/async-profiler/async-profiler-${ASYNC_PROFILER}-${TARGETOS}-${ARCH}.tar.gz" | tar -xzC .
79
79
ln -s "/stackable/async-profiler-${ASYNC_PROFILER}-${TARGETOS}-${ARCH}" /stackable/async-profiler
80
80
81
81
# We're removing these to make the intermediate layer smaller
@@ -87,8 +87,12 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
87
87
rm -rf /stackable/.npm/*
88
88
rm -rf /stackable/.cache/*
89
89
fi
90
+
91
+ # set correct groups
92
+ chmod --recursive g=u /stackable
90
93
EOF
91
94
95
+
92
96
FROM stackable/image/java-devel AS opa-authorizer-builder
93
97
94
98
ARG OPA_AUTHORIZER
@@ -99,7 +103,6 @@ USER ${STACKABLE_USER_UID}
99
103
WORKDIR /stackable
100
104
101
105
RUN --mount=type=cache,id=maven-opa,uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
102
-
103
106
# ##
104
107
# ## OPA Authorizer (only for 2.6 upwards)
105
108
# ##
@@ -117,12 +120,15 @@ else
117
120
touch hbase-opa-authorizer/target/hbase-opa-authorizer.jar
118
121
fi
119
122
120
-
121
123
if [ "${DELETE_CACHES}" = "true" ] ; then
122
124
rm -rf /stackable/.m2/repository/*
123
125
fi
126
+
127
+ # set correct groups
128
+ chmod --recursive g=u /stackable
124
129
EOF
125
130
131
+
126
132
FROM stackable/image/java-devel AS hbase-operator-tools-builder
127
133
128
134
ARG HBASE_OPERATOR_TOOLS
@@ -141,7 +147,7 @@ ARG DELETE_CACHES="true"
141
147
COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbck2.env /stackable/bin/
142
148
COPY --chown=${STACKABLE_USER_UID}:0 hbase/hbase-operator-tools/stackable/patches /stackable/patches
143
149
COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/patches/apply_patches.sh /stackable/patches
144
- COPY --chown=${STACKABLE_USER_UID}:0 --chmod=755 hbase/stackable/bin/hbase-entrypoint.sh /stackable/bin/
150
+ COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbase-entrypoint.sh /stackable/bin/
145
151
146
152
USER ${STACKABLE_USER_UID}
147
153
WORKDIR /stackable
@@ -150,7 +156,7 @@ WORKDIR /stackable
150
156
# We need to explicitly give the uid to use
151
157
RUN --mount=type=cache,id=maven-hbase-operator-tools-${HBASE_OPERATOR_TOOLS},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
152
158
153
- curl "https://repo.stackable.tech/repository/packages/hbase-operator-tools/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}-src.tar.gz" | tar -xzC .
159
+ curl --fail "https://repo.stackable.tech/repository/packages/hbase-operator-tools/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}-src.tar.gz" | tar -xzC .
154
160
mv hbase-operator-tools-${HBASE_OPERATOR_TOOLS} hbase-operator-tools-${HBASE_OPERATOR_TOOLS}-src
155
161
chmod +x patches/apply_patches.sh
156
162
patches/apply_patches.sh ${HBASE_OPERATOR_TOOLS} hbase-operator-tools-${HBASE_OPERATOR_TOOLS}-src
@@ -187,6 +193,9 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
187
193
rm -rf /stackable/.npm/*
188
194
rm -rf /stackable/.cache/*
189
195
fi
196
+
197
+ # set correct groups
198
+ chmod --recursive g=u /stackable
190
199
EOF
191
200
192
201
@@ -202,9 +211,9 @@ USER ${STACKABLE_USER_UID}
202
211
WORKDIR /stackable
203
212
204
213
COPY --from=hadoop-builder --chown=${STACKABLE_USER_UID}:0 \
205
- /stackable/hadoop/share/hadoop/tools/lib/aws-java-sdk-bundle-*.jar \
206
- /stackable/hadoop/share/hadoop/tools/lib/hadoop-aws-${HADOOP}.jar \
207
- /stackable/hadoop/share/hadoop/tools/lib/
214
+ /stackable/hadoop/share/hadoop/tools/lib/aws-java-sdk-bundle-*.jar \
215
+ /stackable/hadoop/share/hadoop/tools/lib/hadoop-aws-${HADOOP}.jar \
216
+ /stackable/hadoop/share/hadoop/tools/lib/
208
217
209
218
COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/export-snapshot-to-s3.env /stackable/bin/
210
219
@@ -218,8 +227,12 @@ export LIBS=$(find /stackable/hadoop/share/hadoop -name '*.jar' -printf '%p:' |
218
227
envsubst '${PRODUCT}:${LIBS}' < /stackable/bin/export-snapshot-to-s3.env > /stackable/bin/export-snapshot-to-s3
219
228
chmod +x /stackable/bin/export-snapshot-to-s3
220
229
rm /stackable/bin/export-snapshot-to-s3.env
230
+
231
+ # set correct groups
232
+ chmod --recursive g=u /stackable
221
233
EOF
222
234
235
+
223
236
FROM stackable/image/java-devel AS phoenix-builder
224
237
225
238
ARG PRODUCT
@@ -240,7 +253,7 @@ WORKDIR /stackable
240
253
241
254
RUN --mount=type=cache,id=maven-phoenix-${PHOENIX},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
242
255
cd /stackable
243
- curl "https://repo.stackable.tech/repository/packages/phoenix/phoenix-${PHOENIX}-src.tar.gz" | tar -xzC .
256
+ curl --fail "https://repo.stackable.tech/repository/packages/phoenix/phoenix-${PHOENIX}-src.tar.gz" | tar -xzC .
244
257
mv phoenix-${PHOENIX} phoenix-${PHOENIX}-src
245
258
246
259
chmod +x patches/apply_patches.sh
@@ -269,7 +282,6 @@ mv phoenix-${PHOENIX}-src/phoenix-assembly/target/bom.json /stackable/phoenix-${
269
282
rm -rf /stackable/phoenix-${PHOENIX}-src
270
283
ln -s "/stackable/phoenix-${HBASE_PROFILE}-${PHOENIX}-bin" /stackable/phoenix
271
284
272
-
273
285
# We're removing these to make the intermediate layer smaller
274
286
# This can be necessary even though it's only a builder image because the GitHub Action Runners only have very limited space available
275
287
# and we are sometimes running into errors because we're out of space.
@@ -279,6 +291,9 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
279
291
rm -rf /stackable/.npm/*
280
292
rm -rf /stackable/.cache/*
281
293
fi
294
+
295
+ # set correct groups
296
+ chmod --recursive g=u /stackable
282
297
EOF
283
298
284
299
@@ -333,8 +348,8 @@ COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-s3-builder /stackable/hadoop/
333
348
# hadoop-azure-${HADOOP}.jar contains the AzureBlobFileSystem which is required
334
349
# by hadoop-common-${HADOOP}.jar if the scheme of a file system is "abfs://".
335
350
COPY --chown=${STACKABLE_USER_UID}:0 --from=hadoop-builder \
336
- /stackable/hadoop/share/hadoop/tools/lib/hadoop-azure-${HADOOP}.jar \
337
- /stackable/hbase-${PRODUCT}/lib/
351
+ /stackable/hadoop/share/hadoop/tools/lib/hadoop-azure-${HADOOP}.jar \
352
+ /stackable/hbase-${PRODUCT}/lib/
338
353
339
354
COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/hbase-opa-authorizer/target/hbase-opa-authorizer*.jar /stackable/hbase-${PRODUCT}/lib
340
355
@@ -352,24 +367,46 @@ microdnf install \
352
367
353
368
microdnf clean all
354
369
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n " | sort > /stackable/package_manifest.txt
370
+ chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
371
+ chmod g=u /stackable/package_manifest.txt
355
372
rm -rf /var/cache/yum
356
373
357
374
ln --symbolic --logical --verbose "/stackable/hbase-${PRODUCT}" /stackable/hbase
375
+ chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase
376
+ chmod g=u /stackable/hbase
377
+
358
378
ln --symbolic --logical --verbose "/stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}" /stackable/hbase-operator-tools
359
- ln --symbolic --logical --verbose "/stackable/phoenix/phoenix-server-hbase-${HBASE_PROFILE}.jar" "/stackable/hbase/lib/phoenix-server-hbase-${HBASE_PROFILE}.jar"
379
+ chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase-operator-tools
380
+ chmod g=u /stackable/hbase-operator-tools
360
381
361
- # All files and folders owned by root group to support running as arbitrary users.
362
- # This is best practice as all container users will belong to the root group (0).
363
- chown -R ${STACKABLE_USER_UID}:0 /stackable
364
- chmod -R g=u /stackable
382
+ ln --symbolic --logical --verbose "/stackable/phoenix/phoenix-server-hbase-${HBASE_PROFILE}.jar" "/stackable/hbase/lib/phoenix-server-hbase-${HBASE_PROFILE}.jar"
383
+ chown --no-dereference ${STACKABLE_USER_UID}:0 "/stackable/hbase/lib/phoenix-server-hbase-${HBASE_PROFILE}.jar"
384
+ chmod g=u "/stackable/hbase/lib/phoenix-server-hbase-${HBASE_PROFILE}.jar"
385
+
386
+ # fix missing permissions
387
+ chmod g=u /stackable/async-profiler
388
+ chmod g=u /stackable/bin
389
+ chmod g=u /stackable/jmx
390
+ chmod g=u /stackable/phoenix
391
+ # the whole directory tree /stackable/hadoop/share/hadoop/tools/lib/ must be adapted
392
+ find /stackable/hadoop -type d -exec chmod g=u {} +
365
393
EOF
366
394
367
395
# ----------------------------------------
368
- # Attention: We are changing the group of all files in /stackable directly above
369
- # If you do any file based actions (copying / creating etc.) below this comment you
370
- # absolutely need to make sure that the correct permissions are applied!
371
- # chown ${STACKABLE_USER_UID}:0
396
+ # Checks
397
+ # This section is to run final checks to ensure the created final images
398
+ # adhere to several minimal requirements like:
399
+ # - check file permissions and ownerships
400
+ # ----------------------------------------
401
+
402
+ # Check that permissions and ownership in /stackable are set correctly
403
+ # This will fail and stop the build if any mismatches are found.
404
+ RUN <<EOF
405
+ /bin/check-permissions-ownership.sh /stackable ${STACKABLE_USER_UID} 0
406
+ EOF
407
+
372
408
# ----------------------------------------
409
+ # Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
373
410
374
411
USER ${STACKABLE_USER_UID}
375
412
ENV HBASE_CONF_DIR=/stackable/hbase/conf
0 commit comments