diff --git a/CHANGELOG.md b/CHANGELOG.md index ba9a03670..bbb5385da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ All notable changes to this project will be documented in this file. - hive: check for correct permissions and ownerships in /stackable folder via `check-permissions-ownership.sh` provided in stackable-base image ([#1040]). - spark-connect-client: A new image for Spark connect tests and demos ([#1034]) +- kafka: check for correct permissions and ownerships in /stackable folder via + `check-permissions-ownership.sh` provided in stackable-base image ([#1041]). - nifi: check for correct permissions and ownerships in /stackable folder via `check-permissions-ownership.sh` provided in stackable-base image ([#1027]). - opa: check for correct permissions and ownerships in /stackable folder via @@ -37,6 +39,7 @@ All notable changes to this project will be documented in this file. - hadoop: reduce docker image size by removing the recursive chown/chmods in the final image ([#1029]). - hbase: reduce docker image size by removing the recursive chown/chmods in the final image ([#1028]). - hive: reduce docker image size by removing the recursive chown/chmods in the final image ([#1040]). +- kafka: reduce docker image size by removing the recursive chown/chmods in the final image ([#1041]). - nifi: reduce docker image size by removing the recursive chown/chmods in the final image ([#1027]). - opa: reduce docker image size by removing the recursive chown/chmods in the final image ([#1038]). - spark-k8s: reduce docker image size by removing the recursive chown/chmods in the final image ([#1042]). @@ -51,6 +54,7 @@ All notable changes to this project will be documented in this file. [#1038]: https://github.com/stackabletech/docker-images/pull/1038 [#1039]: https://github.com/stackabletech/docker-images/pull/1039 [#1040]: https://github.com/stackabletech/docker-images/pull/1040 +[#1041]: https://github.com/stackabletech/docker-images/pull/1041 [#1042]: https://github.com/stackabletech/docker-images/pull/1042 [#1044]: https://github.com/stackabletech/docker-images/pull/1044 [#1050]: https://github.com/stackabletech/docker-images/pull/1050 diff --git a/kafka/Dockerfile b/kafka/Dockerfile index 8005550fb..2d0ec6194 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -27,30 +27,35 @@ WORKDIR /stackable COPY --chown=${STACKABLE_USER_UID}:0 kafka/stackable/patches/apply_patches.sh /stackable/kafka-${PRODUCT}-src/patches/apply_patches.sh COPY --chown=${STACKABLE_USER_UID}:0 kafka/stackable/patches/${PRODUCT} /stackable/kafka-${PRODUCT}-src/patches/${PRODUCT} +COPY --chown=${STACKABLE_USER_UID}:0 kafka/stackable/jmx/ /stackable/jmx/ -RUN curl "https://repo.stackable.tech/repository/packages/kafka/kafka-${PRODUCT}-src.tgz" | tar -xzC . && \ - cd kafka-${PRODUCT}-src && \ - ./patches/apply_patches.sh ${PRODUCT} && \ - # TODO: Try to install gradle via package manager (if possible) instead of fetching it from the internet - # We don't specify "-x test" to skip the tests, as we might bump some Kafka internal dependencies in the future and - # it's a good idea to run the tests in this case. - ./gradlew clean releaseTarGz && \ - ./gradlew cyclonedxBom && \ - tar -xf core/build/distributions/kafka_${SCALA}-${PRODUCT}.tgz -C /stackable && \ - cp build/reports/bom.json /stackable/kafka_${SCALA}-${PRODUCT}.cdx.json && \ - rm -rf /stackable/kafka_${SCALA}-${PRODUCT}/site-docs/ && \ - rm -rf /stackable/kafka-${PRODUCT}-src +RUN < /stackable/package_manifest.txt +chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt +chmod g=u /stackable/package_manifest.txt rm -rf /var/cache/yum ln -s /stackable/bin/kcat-${KCAT} /stackable/bin/kcat +chown -h ${STACKABLE_USER_UID}:0 /stackable/bin/kcat # kcat was located in /stackable/kcat - legacy ln -s /stackable/bin/kcat /stackable/kcat +chown -h ${STACKABLE_USER_UID}:0 /stackable/kcat ln -s /stackable/kafka_${SCALA}-${PRODUCT} /stackable/kafka +chown -h ${STACKABLE_USER_UID}:0 /stackable/kafka -# All files and folders owned by root group to support running as arbitrary users. -# This is best practice as all container users will belong to the root group (0). -chown -R ${STACKABLE_USER_UID}:0 /stackable -chmod -R g=u /stackable +# fix missing permissions +chmod g=u /stackable/bin +chmod g=u /stackable/jmx +chmod g=u /stackable/kafka_${SCALA}-${PRODUCT} +EOF + +# ---------------------------------------- +# Checks +# This section is to run final checks to ensure the created final images +# adhere to several minimal requirements like: +# - check file permissions and ownerships +# ---------------------------------------- + +# Check that permissions and ownership in /stackable are set correctly +# This will fail and stop the build if any mismatches are found. +RUN <