@@ -60,39 +60,52 @@ ARG RELEASE
6060ARG STACKABLE_USER_UID
6161
6262LABEL \
63- name="Apache ZooKeeper" \
64- 65- vendor="Stackable GmbH" \
66- version="${PRODUCT}" \
67- release="${RELEASE}" \
68- summary="The Stackable image for Apache ZooKeeper." \
69- description="This image is deployed by the Stackable Operator for Apache ZooKeeper."
63+ name="Apache ZooKeeper" \
64+ 65+ vendor="Stackable GmbH" \
66+ version="${PRODUCT}" \
67+ release="${RELEASE}" \
68+ summary="The Stackable image for Apache ZooKeeper." \
69+ description="This image is deployed by the Stackable Operator for Apache ZooKeeper."
70+
71+ # Copy over the ZooKeeper binary folder
72+ COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-bin /stackable/apache-zookeeper-${PRODUCT}-bin/
73+ COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/jmx /stackable/jmx/
74+ COPY zookeeper/licenses /licenses
7075
7176RUN <<EOF
7277microdnf update
7378microdnf clean all
7479rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n " | sort > /stackable/package_manifest.txt
7580chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
81+ chmod g=u /stackable/package_manifest.txt
7682rm -rf /var/cache/yum
77- EOF
78-
79- # Copy over the ZooKeeper binary folder
80- COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-bin /stackable/apache-zookeeper-${PRODUCT}-bin/
81- COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/jmx /stackable/jmx/
82- COPY zookeeper/licenses /licenses
8383
8484# Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-bin/
8585# to preserve the folder name with the version.
86- RUN <<EOF
8786ln -s /stackable/apache-zookeeper-${PRODUCT}-bin/ /stackable/zookeeper
8887chown -h ${STACKABLE_USER_UID}:0 /stackable/zookeeper
88+
89+ # fix missing permissions
90+ chmod g=u /stackable/jmx
91+ chmod g=u /stackable/apache-zookeeper-${PRODUCT}-bin/
92+ EOF
93+
94+ # ----------------------------------------
95+ # Checks
96+ # This section is to run final checks to ensure the created final images
97+ # adhere to several minimal requirements like:
98+ # - check file permissions and ownerships
99+ # ----------------------------------------
100+
101+ # Check that permissions and ownership in /stackable are set correctly
102+ # This will fail and stop the build if any mismatches are found.
103+ RUN <<EOF
104+ /bin/check-permissions-ownership.sh /stackable ${STACKABLE_USER_UID} 0
89105EOF
90106
91107# ----------------------------------------
92- # Attention:
93- # If you do any file based actions (copying / creating etc.) below this comment you
94- # absolutely need to make sure that the correct permissions are applied!
95- # chown ${STACKABLE_USER_UID}:0
108+ # Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
96109# ----------------------------------------
97110
98111ENV ZOOKEEPER_HOME=/stackable/zookeeper
0 commit comments