Skip to content

Commit da10bdc

Browse files
committed
cleanup
1 parent 463954f commit da10bdc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

trino/Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ RUN curl "https://repo.stackable.tech/repository/packages/trino-server/trino-ser
2727
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/patches/apply_patches.sh /stackable/trino-server-${PRODUCT}-src/patches/apply_patches.sh
2828
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/patches/${PRODUCT} /stackable/trino-server-${PRODUCT}-src/patches/${PRODUCT}
2929
COPY --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?
31+
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/jmx /stackable/jmx
3032

3133
# adding a hadolint ignore for SC2215, due to https://github.com/hadolint/hadolint/issues/980
3234
# hadolint ignore=SC2215
@@ -49,19 +51,19 @@ git tag ${PRODUCT}
4951
# We need to use ./mvnw instead of mvn to get a recent maven version (which is required to build Trino)
5052
./mvnw --batch-mode --no-transfer-progress package -DskipTests --projects="!docs,!core/trino-server-rpm"
5153

52-
# Delete the worst intermediate build products to free some space
54+
# Delete intermediate build products to free some space and keep runners happy
5355
rm -r /stackable/trino-server-${PRODUCT}-src/plugin/*/target /stackable/trino-server-${PRODUCT}-src/core/trino-server/target/trino-server-${PRODUCT}
5456

5557
# Extract from tarball to save space; the tarball deduplicates jars (replacing them with symlinks),
5658
# while the raw output folder does not
5759
tar -xzf /stackable/trino-server-${PRODUCT}-src/core/trino-server/target/trino-server-${PRODUCT}.tar.gz -C /stackable
5860
mv /stackable/trino-server-${PRODUCT}-src/core/trino-server/target/bom.json /stackable/trino-server-${PRODUCT}/trino-server-${PRODUCT}.cdx.json
5961

60-
# Delete all intermediate build products to free some more space
62+
# Delete intermediate build products to free some space and keep runners happy
6163
rm -r /stackable/trino-server-${PRODUCT}-src
64+
rm -r /stackable/.m2
6265

6366
# JMX Exporter
64-
mkdir /stackable/jmx
6567
curl --fail https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar -o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
6668
chmod +x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
6769
# Storage connector
@@ -70,8 +72,7 @@ mv /trino-storage-${PRODUCT}/ /stackable/trino-server-${PRODUCT}/plugin/trino-st
7072
ln -s /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent.jar
7173
ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server
7274
# We need to change groups here and not in the final image (file changes bloat images)
73-
chmod -R g=u /stackable/trino-server-${PRODUCT}
74-
chmod -R g=u /stackable/jmx
75+
chmod -R g=u /stackable
7576
EOF
7677

7778
FROM stackable/image/java-base
@@ -101,10 +102,11 @@ RUN microdnf update && \
101102

102103
WORKDIR /stackable
103104

104-
COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable/trino-server-${PRODUCT} /stackable/trino-server-${PRODUCT}
105-
COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable/jmx /stackable/jmx
106-
# do not copy patches -> .dockerignore?
107-
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/jmx /stackable/jmx
105+
# If /stackable has any build artifacts / leftovers make sure its removed properly
106+
# or only copy what is actually required in the final image like:
107+
# COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable/foo /stackable/foo
108+
COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable /stackable
109+
108110
COPY --chown=${STACKABLE_USER_UID}:0 trino/licenses /licenses
109111

110112
# ----------------------------------------

0 commit comments

Comments
 (0)