@@ -27,7 +27,6 @@ RUN curl "https://repo.stackable.tech/repository/packages/trino-server/trino-ser
2727COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/patches/apply_patches.sh /stackable/trino-server-${PRODUCT}-src/patches/apply_patches.sh
2828COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/patches/${PRODUCT} /stackable/trino-server-${PRODUCT}-src/patches/${PRODUCT}
2929COPY --chown=${STACKABLE_USER_UID}:0 --from=trino-storage-connector-image /stackable/trino-storage-${PRODUCT}-src/target/trino-storage-${PRODUCT} /trino-storage-${PRODUCT}
30- # do not copy patches -> .dockerignore?
3130COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/jmx /stackable/jmx
3231
3332# adding a hadolint ignore for SC2215, due to https://github.com/hadolint/hadolint/issues/980
@@ -66,13 +65,16 @@ rm -r /stackable/.m2
6665# JMX Exporter
6766curl --fail https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar -o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
6867chmod +x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
68+
6969# Storage connector
7070mv /trino-storage-${PRODUCT}/ /stackable/trino-server-${PRODUCT}/plugin/trino-storage-${PRODUCT}/
71+
7172# Softlinks
7273ln -s /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent.jar
7374ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server
74- # We need to change groups here and not in the final image (file changes bloat images)
75- chmod -R g=u /stackable
75+
76+ # Set correct permissions
77+ chmod --recursive g=u /stackable
7678EOF
7779
7880FROM stackable/image/java-base
@@ -90,33 +92,41 @@ LABEL \
9092 summary="The Stackable image for Trino." \
9193 description="This image is deployed by the Stackable Operator for Trino."
9294
93- RUN microdnf update && \
94- microdnf install \
95+ RUN <<EOF
96+ microdnf update
97+ microdnf install \
9598 gzip \
9699 httpd-tools \
97100 python \
98101 tar \
99102 # Required by snappy and duckdb, see https://github.com/trinodb/trino/pull/25143
100103 libstdc++ \
101- zip && \
102- microdnf clean all && \
103- rm -rf /var/cache/yum
104-
105- WORKDIR /stackable
104+ zip
105+ microdnf clean all
106+ rm -rf /var/cache/yum
107+ EOF
106108
107109# If /stackable has any build artifacts / leftovers make sure its removed properly
108110# or only copy what is actually required in the final image like:
109111# COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable/foo /stackable/foo
110112COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable /stackable
111-
112113COPY --chown=${STACKABLE_USER_UID}:0 trino/licenses /licenses
113114
114115# ----------------------------------------
115- # Attention:
116- # If you do any file based actions (copying / creating etc.) below this comment you
117- # absolutely need to make sure that the correct permissions are applied!
118- # chown ${STACKABLE_USER_UID}:0
116+ # Checks
117+ # This section is to run final checks to ensure the created final images
118+ # adhere to several minimal requirements like:
119+ # - check file permissions and ownerships
120+ # ----------------------------------------
121+
122+ # Check that permissions and ownership in /stackable are set correctly
123+ # This will fail and stop the build if any mismatches are found.
124+ RUN <<EOF
125+ /bin/check-permissions-ownership.sh /stackable ${STACKABLE_USER_UID} 0
126+ EOF
127+
119128# ----------------------------------------
129+ # Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
120130
121131USER ${STACKABLE_USER_UID}
122132WORKDIR /stackable/trino-server
0 commit comments