Skip to content

Commit 6ae4246

Browse files
committed
consolidation
1 parent 49cdc09 commit 6ae4246

File tree

2 files changed

+42
-20
lines changed

2 files changed

+42
-20
lines changed

kafka/Dockerfile

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ ARG KCAT
6666
ARG STACKABLE_USER_UID
6767

6868
LABEL \
69-
name="Apache Kafka" \
70-
maintainer="[email protected]" \
71-
vendor="Stackable GmbH" \
72-
version="${PRODUCT}" \
73-
release="${RELEASE}" \
74-
summary="The Stackable image for Apache Kafka." \
75-
description="This image is deployed by the Stackable Operator for Apache Kafka."
69+
name="Apache Kafka" \
70+
maintainer="[email protected]" \
71+
vendor="Stackable GmbH" \
72+
version="${PRODUCT}" \
73+
release="${RELEASE}" \
74+
summary="The Stackable image for Apache Kafka." \
75+
description="This image is deployed by the Stackable Operator for Apache Kafka."
7676

7777
COPY --chown=${STACKABLE_USER_UID}:0 --from=kafka-builder /stackable/kafka_${SCALA}-${PRODUCT} /stackable/kafka_${SCALA}-${PRODUCT}
7878
COPY --chown=${STACKABLE_USER_UID}:0 --from=kafka-builder /stackable/kafka_${SCALA}-${PRODUCT}.cdx.json /stackable/kafka_${SCALA}-${PRODUCT}/kafka_${SCALA}-${PRODUCT}.cdx.json
@@ -93,6 +93,7 @@ microdnf install \
9393
microdnf clean all
9494
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | sort > /stackable/package_manifest.txt
9595
chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
96+
chmod g=u /stackable/package_manifest.txt
9697
rm -rf /var/cache/yum
9798

9899
ln -s /stackable/bin/kcat-${KCAT} /stackable/bin/kcat
@@ -102,13 +103,28 @@ ln -s /stackable/bin/kcat /stackable/kcat
102103
chown -h ${STACKABLE_USER_UID}:0 /stackable/kcat
103104
ln -s /stackable/kafka_${SCALA}-${PRODUCT} /stackable/kafka
104105
chown -h ${STACKABLE_USER_UID}:0 /stackable/kafka
106+
107+
# fix missing permissions
108+
chmod g=u /stackable/bin
109+
chmod g=u /stackable/jmx
110+
chmod g=u /stackable/kafka_${SCALA}-${PRODUCT}
111+
EOF
112+
113+
# ----------------------------------------
114+
# Checks
115+
# This section is to run final checks to ensure the created final images
116+
# adhere to several minimal requirements like:
117+
# - check file permissions and ownerships
118+
# ----------------------------------------
119+
120+
# Check that permissions and ownership in /stackable are set correctly
121+
# This will fail and stop the build if any mismatches are found.
122+
RUN <<EOF
123+
/bin/check-permissions-ownership.sh /stackable ${STACKABLE_USER_UID} 0
105124
EOF
106125

107126
# ----------------------------------------
108-
# Attention:
109-
# If you do any file based actions (copying / creating etc.) below this comment you
110-
# absolutely need to make sure that the correct permissions are applied!
111-
# chown ${STACKABLE_USER_UID}:0
127+
# Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
112128
# ----------------------------------------
113129

114130
USER ${STACKABLE_USER_UID}

kcat/Dockerfile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ FROM stackable/image/java-base AS builder
99
ARG PRODUCT
1010
ARG STACKABLE_USER_UID
1111

12-
RUN microdnf update \
13-
&& microdnf install \
12+
RUN <<EOF
13+
microdnf update
14+
microdnf install \
1415
cmake \
1516
cyrus-sasl-devel \
1617
gcc-c++ \
@@ -22,16 +23,21 @@ RUN microdnf update \
2223
wget \
2324
which \
2425
zlib \
25-
zlib-devel && \
26-
microdnf clean all && \
27-
rm -rf /var/cache/yum
26+
zlib-devel
27+
microdnf clean all
28+
rm -rf /var/cache/yum
29+
EOF
2830

2931
WORKDIR /stackable
3032

31-
RUN curl -O https://repo.stackable.tech/repository/packages/kcat/kcat-${PRODUCT}.tar.gz \
32-
&& tar xvfz kcat-${PRODUCT}.tar.gz \
33-
&& cd kcat-${PRODUCT} \
34-
&& ./bootstrap.sh
33+
RUN <<EOF
34+
curl -O https://repo.stackable.tech/repository/packages/kcat/kcat-${PRODUCT}.tar.gz
35+
tar xvfz kcat-${PRODUCT}.tar.gz
36+
cd kcat-${PRODUCT}
37+
./bootstrap.sh
38+
# set correct permissions
39+
chmod --recursive g=u /stackable/kcat-${PRODUCT}
40+
EOF
3541

3642
COPY --chown=${STACKABLE_USER_UID}:0 kcat/licenses /licenses
3743

0 commit comments

Comments
 (0)