Skip to content

Commit ff55b16

Browse files
authored
fix: reduce airflow/superset image size (#1326)
* fix: reduce airflow/superset image size * chore: changelog
1 parent 7ac7727 commit ff55b16

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ All notable changes to this project will be documented in this file.
3535
- airflow,superset: Build from source ([#1304]).
3636
- kafka: Add updated JMX config `server.yaml` for KRaft ([#1308]).
3737
- airflow: Add apache-kafka provider plus dependencies to `3.0.6` image ([#1313]).
38+
- airflow,superset: Reduce image size and add a snapshot of the source code ([#1326]).
3839

3940
### Changed
4041

@@ -122,6 +123,7 @@ All notable changes to this project will be documented in this file.
122123
[#1320]: https://github.com/stackabletech/docker-images/pull/1320
123124
[#1322]: https://github.com/stackabletech/docker-images/pull/1322
124125
[#1323]: https://github.com/stackabletech/docker-images/pull/1323
126+
[#1326]: https://github.com/stackabletech/docker-images/pull/1326
125127

126128
## [25.7.0] - 2025-07-23
127129

airflow/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \
7777
npm \
7878
nodejs \
7979
# Needed to modify the SBOM
80-
jq && \
80+
jq \
81+
# Needed to create the source code snapshot
82+
tar && \
8183
microdnf clean all && \
8284
rm -rf /var/cache/yum
8385

@@ -103,6 +105,8 @@ uv tool install hatch
103105

104106
cd "$(/stackable/patchable --images-repo-root=src checkout airflow ${PRODUCT_VERSION})"
105107

108+
tar -czf /stackable/airflow-${PRODUCT_VERSION}-src.tar.gz .
109+
106110
if [ -d "./airflow-core" ]; then
107111
# Airflow 3.x
108112
cd airflow-core/src/airflow/ui
@@ -155,6 +159,10 @@ jq '.dependencies |= map(if .ref | test("^apache-airflow-providers-") then
155159
else
156160
.
157161
end)' /tmp/sbom.json > /stackable/app/airflow-${PRODUCT_VERSION}.cdx.json
162+
163+
# Clean up build artifacts and temporary files to reduce image size
164+
cd /stackable
165+
rm -rf ./src
158166
EOF
159167

160168
RUN <<EOF

superset/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \
6969
# Needed to build Superset UI assets
7070
npm \
7171
nodejs \
72+
# Needed to create the source code snapshot
73+
tar \
7274
&& microdnf clean all && \
7375
rm -rf /var/cache/yum
7476

@@ -97,6 +99,9 @@ pip install --no-cache-dir --upgrade pip setuptools==75.2.0 uv==${UV_VERSION}
9799

98100
cd "$(/stackable/patchable --images-repo-root=src checkout superset ${PRODUCT_VERSION})"
99101

102+
# Create snapshot of the source code including custom patches
103+
tar -czf /stackable/superset-${PRODUCT_VERSION}-src.tar.gz .
104+
100105
# Build front-end assets
101106
cd superset-frontend
102107

@@ -153,6 +158,10 @@ uv pip install --no-cache-dir /tmp/opa_authorizer-0.1.0-py3-none-any.whl
153158
cyclonedx-py environment --schema-version 1.5 --outfile /stackable/app/superset-${PRODUCT_VERSION}.cdx.json
154159
uv pip uninstall cyclonedx-bom
155160

161+
# Clean up build artifacts and temporary files to reduce image size
162+
cd /stackable
163+
rm -rf ./src
164+
156165
chmod --recursive g=u /stackable
157166
EOF
158167

0 commit comments

Comments
 (0)