Skip to content

Commit 4ad3855

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/spark-k8s-fix-size-consolidation
2 parents 367b96e + ceaa1cd commit 4ad3855

File tree

13 files changed

+650
-457
lines changed

13 files changed

+650
-457
lines changed

CHANGELOG.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,31 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88

9+
- airflow: check for correct permissions and ownerships in /stackable folder via
10+
`check-permissions-ownership.sh` provided in stackable-base image ([#1054]).
11+
- druid: check for correct permissions and ownerships in /stackable folder via
12+
`check-permissions-ownership.sh` provided in stackable-base image ([#1039]).
13+
- hadoop: check for correct permissions and ownerships in /stackable folder via
14+
`check-permissions-ownership.sh` provided in stackable-base image ([#1029]).
15+
- hbase: check for correct permissions and ownerships in /stackable folder via
16+
`check-permissions-ownership.sh` provided in stackable-base image ([#1028]).
17+
- hive: check for correct permissions and ownerships in /stackable folder via
18+
`check-permissions-ownership.sh` provided in stackable-base image ([#1040]).
919
- spark-connect-client: A new image for Spark connect tests and demos ([#1034])
20+
- kafka: check for correct permissions and ownerships in /stackable folder via
21+
`check-permissions-ownership.sh` provided in stackable-base image ([#1041]).
1022
- nifi: check for correct permissions and ownerships in /stackable folder via
1123
`check-permissions-ownership.sh` provided in stackable-base image ([#1027]).
24+
- opa: check for correct permissions and ownerships in /stackable folder via
25+
`check-permissions-ownership.sh` provided in stackable-base image ([#1038]).
1226
- spark-k8s: check for correct permissions and ownerships in /stackable folder via
1327
`check-permissions-ownership.sh` provided in stackable-base image ([#1055]).
28+
- superset: check for correct permissions and ownerships in /stackable folder via
29+
`check-permissions-ownership.sh` provided in stackable-base image ([#1053]).
30+
- trino: check for correct permissions and ownerships in /stackable folder via
31+
`check-permissions-ownership.sh` provided in stackable-base image ([#1025]).
32+
- zookeeper: check for correct permissions and ownerships in /stackable folder via
33+
`check-permissions-ownership.sh` provided in stackable-base image ([#1043]).
1434

1535
### Changed
1636

@@ -19,15 +39,33 @@ All notable changes to this project will be documented in this file.
1939

2040
### Fixed
2141

42+
- druid: reduce docker image size by removing the recursive chown/chmods in the final image ([#1039]).
43+
- hadoop: reduce docker image size by removing the recursive chown/chmods in the final image ([#1029]).
44+
- hbase: reduce docker image size by removing the recursive chown/chmods in the final image ([#1028]).
45+
- hive: reduce docker image size by removing the recursive chown/chmods in the final image ([#1040]).
46+
- kafka: reduce docker image size by removing the recursive chown/chmods in the final image ([#1041]).
47+
- Add `--locked` flag to `cargo install` commands for reproducible builds ([#1044]).
2248
- nifi: reduce docker image size by removing the recursive chown/chmods in the final image ([#1027]).
49+
- opa: reduce docker image size by removing the recursive chown/chmods in the final image ([#1038]).
2350
- spark-k8s: reduce docker image size by removing the recursive chown/chmods in the final image ([#1042]).
24-
- Add `--locked` flag to `cargo install` commands for reproducible builds ([#1044]).
51+
- trino: reduce docker image size by removing the recursive chown/chmods in the final image ([#1025]).
52+
- zookeeper: reduce docker image size by removing the recursive chown/chmods in the final image ([#1043]).
2553

54+
[#1025]: https://github.com/stackabletech/docker-images/pull/1025
2655
[#1027]: https://github.com/stackabletech/docker-images/pull/1027
56+
[#1028]: https://github.com/stackabletech/docker-images/pull/1028
57+
[#1029]: https://github.com/stackabletech/docker-images/pull/1029
2758
[#1034]: https://github.com/stackabletech/docker-images/pull/1034
59+
[#1038]: https://github.com/stackabletech/docker-images/pull/1038
60+
[#1039]: https://github.com/stackabletech/docker-images/pull/1039
61+
[#1040]: https://github.com/stackabletech/docker-images/pull/1040
62+
[#1041]: https://github.com/stackabletech/docker-images/pull/1041
2863
[#1042]: https://github.com/stackabletech/docker-images/pull/1042
64+
[#1043]: https://github.com/stackabletech/docker-images/pull/1043
2965
[#1044]: https://github.com/stackabletech/docker-images/pull/1044
3066
[#1050]: https://github.com/stackabletech/docker-images/pull/1050
67+
[#1053]: https://github.com/stackabletech/docker-images/pull/1053
68+
[#1054]: https://github.com/stackabletech/docker-images/pull/1054
3169
[#1055]: https://github.com/stackabletech/docker-images/pull/1055
3270

3371
## [25.3.0] - 2025-03-21

airflow/Dockerfile

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ARG PRODUCT
2828
ARG STATSD_EXPORTER
2929
ARG PYTHON
3030
ARG TARGETARCH
31+
ARG STACKABLE_USER_UID
3132

3233
COPY airflow/constraints-${PRODUCT}-python${PYTHON}.txt /tmp/constraints.txt
3334
COPY --from=opa-auth-manager-builder /tmp/opa-auth-manager/dist/opa_auth_manager-0.1.0-py3-none-any.whl /tmp/
@@ -85,9 +86,17 @@ else
8586
end)' /tmp/sbom.json > /stackable/app/airflow-${PRODUCT}.cdx.json
8687
EOF
8788

88-
WORKDIR /stackable
8989
COPY --from=statsd_exporter-builder /statsd_exporter/statsd_exporter /stackable/statsd_exporter
9090
COPY --from=statsd_exporter-builder /statsd_exporter/statsd_exporter-${STATSD_EXPORTER}.cdx.json /stackable/statsd_exporter-${STATSD_EXPORTER}.cdx.json
91+
COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync /stackable/git-sync
92+
93+
RUN <<EOF
94+
mkdir -pv /stackable/airflow
95+
mkdir -pv /stackable/airflow/dags
96+
mkdir -pv /stackable/airflow/logs
97+
chmod --recursive g=u /stackable
98+
EOF
99+
91100

92101
FROM stackable/image/vector AS airflow-main-image
93102

@@ -99,22 +108,26 @@ ARG TARGETARCH
99108
ARG STACKABLE_USER_UID
100109

101110
LABEL name="Apache Airflow" \
102-
maintainer="[email protected]" \
103-
vendor="Stackable GmbH" \
104-
version="${PRODUCT}" \
105-
release="${RELEASE}" \
106-
summary="The Stackable image for Apache Airflow." \
107-
description="This image is deployed by the Stackable Operator for Apache Airflow."
108-
109-
COPY airflow/licenses /licenses
110-
COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/entrypoint.sh /entrypoint.sh
111-
COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/run-airflow.sh /run-airflow.sh
111+
maintainer="[email protected]" \
112+
vendor="Stackable GmbH" \
113+
version="${PRODUCT}" \
114+
release="${RELEASE}" \
115+
summary="The Stackable image for Apache Airflow." \
116+
description="This image is deployed by the Stackable Operator for Apache Airflow."
112117

113118
ENV HOME=/stackable
114119
ENV AIRFLOW_USER_HOME_DIR=/stackable
115120
ENV PATH=$PATH:/bin:$HOME/app/bin
116121
ENV AIRFLOW_HOME=$HOME/airflow
117122

123+
COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/ ${HOME}/
124+
COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/git-sync ${HOME}/git-sync
125+
126+
COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/entrypoint.sh /entrypoint.sh
127+
COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/run-airflow.sh /run-airflow.sh
128+
129+
COPY airflow/licenses /licenses
130+
118131
# Update image and install needed packages
119132
RUN <<EOF
120133
microdnf update
@@ -142,33 +155,33 @@ rm -rf /var/cache/yum
142155
# Get the correct `tini` binary for our architecture.
143156
# It is used as an init alternative in the entrypoint
144157
curl -o /usr/bin/tini "https://repo.stackable.tech/repository/packages/tini/tini-${TINI}-${TARGETARCH}"
158+
159+
# fix missing permissions
145160
chmod a+x /entrypoint.sh
146161
chmod a+x /run-airflow.sh
147162
chmod +x /usr/bin/tini
163+
EOF
148164

149-
mkdir -pv ${AIRFLOW_HOME}
150-
mkdir -pv ${AIRFLOW_HOME}/dags
151-
mkdir -pv ${AIRFLOW_HOME}/logs
165+
# ----------------------------------------
166+
# Checks
167+
# This section is to run final checks to ensure the created final images
168+
# adhere to several minimal requirements like:
169+
# - check file permissions and ownerships
170+
# ----------------------------------------
152171

153-
# All files and folders owned by root to support running as arbitrary users
154-
# This is best practice as all container users will belong to the root group (0)
155-
chown -R ${STACKABLE_USER_UID}:0 /stackable
156-
chmod -R g=u /stackable
172+
# Check that permissions and ownership in ${HOME} are set correctly
173+
# This will fail and stop the build if any mismatches are found.
174+
RUN <<EOF
175+
/bin/check-permissions-ownership.sh ${HOME} ${STACKABLE_USER_UID} 0
157176
EOF
158177

159178
# ----------------------------------------
160-
# Attention: We are changing the group of all files in /stackable directly above
161-
# If you do any file based actions (copying / creating etc.) below this comment you
162-
# absolutely need to make sure that the correct permissions are applied!
163-
# chown ${STACKABLE_USER_UID}:0
179+
# Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
164180
# ----------------------------------------
165181

166182
USER ${STACKABLE_USER_UID}
167183
WORKDIR /stackable
168184

169-
COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/ ${HOME}/
170-
COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync /stackable/git-sync
171-
172185
ENTRYPOINT ["/usr/bin/tini", "--", "/run-airflow.sh"]
173186
CMD []
174187

druid/Dockerfile

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ microdnf update
2525
#
2626
# patch: Required for the apply-patches.sh script
2727
microdnf install \
28-
python-pyyaml \
29-
patch
28+
python-pyyaml \
29+
patch
3030

3131
microdnf clean all
3232
rm -rf /var/cache/yum
@@ -47,9 +47,9 @@ COPY --chown=stackable:0 druid/stackable/patches/${PRODUCT} /stackable/apache-dr
4747
# are still working in the cache directory.
4848

4949
RUN --mount=type=cache,id=maven-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository \
50-
--mount=type=cache,id=npm-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.npm \
51-
--mount=type=cache,id=cache-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.cache \
52-
<<EOF
50+
--mount=type=cache,id=npm-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.npm \
51+
--mount=type=cache,id=cache-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.cache \
52+
<<EOF
5353
curl "https://repo.stackable.tech/repository/packages/druid/apache-druid-${PRODUCT}-src.tar.gz" | tar -xzC .
5454
cd apache-druid-${PRODUCT}-src
5555
./patches/apply_patches.sh ${PRODUCT}
@@ -74,6 +74,9 @@ fi
7474

7575
# Install OPA authorizer extension.
7676
curl "https://repo.stackable.tech/repository/packages/druid/druid-opa-authorizer-${AUTHORIZER}.tar.gz" | tar -xzC /stackable/apache-druid-${PRODUCT}/extensions
77+
78+
# change groups
79+
chmod -R g=u /stackable
7780
EOF
7881

7982
FROM stackable/image/java-base AS final
@@ -106,32 +109,45 @@ LABEL io.k8s.display-name="${NAME}"
106109

107110

108111
COPY --chown=${STACKABLE_USER_UID}:0 --from=druid-builder /stackable/apache-druid-${PRODUCT} /stackable/apache-druid-${PRODUCT}
112+
109113
COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/bin /stackable/bin
110114
COPY --chown=${STACKABLE_USER_UID}:0 druid/licenses /licenses
111115

112116
RUN <<EOF
113117
microdnf update
114118
microdnf clean all
115119
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" | sort > /stackable/package_manifest.txt
120+
chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
121+
chmod g=u /stackable/package_manifest.txt
116122
rm -rf /var/cache/yum
117123

118-
ln -s /stackable/apache-druid-${PRODUCT} /stackable/druid
124+
ln -sf /stackable/apache-druid-${PRODUCT} /stackable/druid
125+
chown -h ${STACKABLE_USER_UID}:0 stackable/druid
119126

120127
# Force to overwrite the existing 'run-druid'
121128
ln -sf /stackable/bin/run-druid /stackable/druid/bin/run-druid
129+
chown -h ${STACKABLE_USER_UID}:0 /stackable/druid/bin/run-druid
122130

123-
# All files and folders owned by root group to support running as arbitrary users.
124-
# This is best practice as all container users will belong to the root group (0).
125-
chown -R ${STACKABLE_USER_UID}:0 /stackable
126-
chmod -R g=u /stackable
131+
# fix missing permissions
132+
chmod -R g=u /stackable/bin
133+
chmod g=u /stackable/apache-druid-${PRODUCT}
127134
EOF
128135

129136
# ----------------------------------------
130-
# Attention: We are changing the group of all files in /stackable directly above
131-
# If you do any file based actions (copying / creating etc.) below this comment you
132-
# absolutely need to make sure that the correct permissions are applied!
133-
# chown ${STACKABLE_USER_UID}:0
137+
# Checks
138+
# This section is to run final checks to ensure the created final images
139+
# adhere to several minimal requirements like:
140+
# - check file permissions and ownerships
141+
# ----------------------------------------
142+
143+
# Check that permissions and ownership in /stackable are set correctly
144+
# This will fail and stop the build if any mismatches are found.
145+
RUN <<EOF
146+
/bin/check-permissions-ownership.sh /stackable ${STACKABLE_USER_UID} 0
147+
EOF
148+
134149
# ----------------------------------------
150+
# Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked.
135151

136152
USER ${STACKABLE_USER_UID}
137153
ENV PATH="${PATH}":/stackable/druid/bin

0 commit comments

Comments
 (0)