@@ -89,9 +89,10 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
8989fi
9090
9191# set correct groups
92- chmod -R g=u /stackable
92+ chmod --recursive g=u /stackable
9393EOF
9494
95+
9596FROM stackable/image/java-devel AS opa-authorizer-builder
9697
9798ARG OPA_AUTHORIZER
@@ -124,9 +125,10 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
124125fi
125126
126127# set correct groups
127- chmod -R g=u /stackable
128+ chmod --recursive g=u /stackable
128129EOF
129130
131+
130132FROM stackable/image/java-devel AS hbase-operator-tools-builder
131133
132134ARG HBASE_OPERATOR_TOOLS
@@ -145,7 +147,7 @@ ARG DELETE_CACHES="true"
145147COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/bin/hbck2.env /stackable/bin/
146148COPY --chown=${STACKABLE_USER_UID}:0 hbase/hbase-operator-tools/stackable/patches /stackable/patches
147149COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/patches/apply_patches.sh /stackable/patches
148- 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/
149151
150152USER ${STACKABLE_USER_UID}
151153WORKDIR /stackable
@@ -193,7 +195,7 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
193195fi
194196
195197# set correct groups
196- chmod -R g=u /stackable
198+ chmod --recursive g=u /stackable
197199EOF
198200
199201
@@ -227,9 +229,10 @@ chmod +x /stackable/bin/export-snapshot-to-s3
227229rm /stackable/bin/export-snapshot-to-s3.env
228230
229231# set correct groups
230- chmod -R g=u /stackable
232+ chmod --recursive g=u /stackable
231233EOF
232234
235+
233236FROM stackable/image/java-devel AS phoenix-builder
234237
235238ARG PRODUCT
@@ -290,7 +293,7 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
290293fi
291294
292295# set correct groups
293- chmod -R g=u /stackable
296+ chmod --recursive g=u /stackable
294297EOF
295298
296299
@@ -365,24 +368,45 @@ microdnf install \
365368microdnf clean all
366369rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n " | sort > /stackable/package_manifest.txt
367370chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
371+ chmod g=u /stackable/package_manifest.txt
368372rm -rf /var/cache/yum
369373
370374ln --symbolic --logical --verbose "/stackable/hbase-${PRODUCT}" /stackable/hbase
371- chown -h ${STACKABLE_USER_UID}:0 /stackable/hbase
375+ chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase
376+ chmod g=u /stackable/hbase
372377
373378ln --symbolic --logical --verbose "/stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}" /stackable/hbase-operator-tools
374- chown -h ${STACKABLE_USER_UID}:0 /stackable/hbase-operator-tools
379+ chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/hbase-operator-tools
380+ chmod g=u /stackable/hbase-operator-tools
375381
376382ln --symbolic --logical --verbose "/stackable/phoenix/phoenix-server-hbase-${HBASE_PROFILE}.jar" "/stackable/hbase/lib/phoenix-server-hbase-${HBASE_PROFILE}.jar"
377- chown -h ${STACKABLE_USER_UID}:0 "/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 {} +
378393EOF
379394
380395# ----------------------------------------
381- # Attention:
382- # If you do any file based actions (copying / creating etc.) below this comment you
383- # absolutely need to make sure that the correct permissions are applied!
384- # 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+
385408# ----------------------------------------
409+ # Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
386410
387411USER ${STACKABLE_USER_UID}
388412ENV HBASE_CONF_DIR=/stackable/hbase/conf
0 commit comments