4
4
# Ignoring DL4006 globally because we inherit the SHELL from our base image
5
5
# hadolint global ignore=DL3038,DL4006
6
6
7
- FROM stackable/image/java-base
7
+ # Not tagging base image because it is built as part of the same process
8
+ # hadolint ignore=DL3006
9
+ FROM stackable/image/java-devel AS storage-connector-builder
10
+
11
+ ARG STORAGE_CONNECTOR
12
+
13
+ WORKDIR /stackable
14
+
15
+ RUN curl --fail -L "https://repo.stackable.tech/repository/packages/trino-storage/trino-storage-${STORAGE_CONNECTOR}-src.tar.gz" | tar -xzC .
16
+ RUN --mount=type=cache,target=/root/.m2/repository cd trino-storage-${STORAGE_CONNECTOR}-src && \
17
+ # Upstream builds are marked as -SNAPSHOT, even for release builds
18
+ mvn versions:set -DnewVersion=${STORAGE_CONNECTOR} && \
19
+ mvn package -DskipTests -Dmaven.gitcommitid.skip=true
20
+
21
+ # # TODO: remove the OPA authorizer builder once Trino versions 414 and 428 are removed
22
+ # Not tagging base image because it is built as part of the same process
23
+ # hadolint ignore=DL3006
24
+ FROM stackable/image/java-devel AS opa-authorizer-builder
25
+
26
+ ARG PRODUCT
27
+ ARG OPA_AUTHORIZER
28
+
29
+ WORKDIR /stackable
30
+
31
+ RUN if [ -n "${OPA_AUTHORIZER}" ]; then \
32
+ curl --fail -L "https://repo.stackable.tech/repository/packages/trino-opa-authorizer/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src.tar.gz" | tar -xzC .; \
33
+ fi
34
+ RUN --mount=type=cache,target=/root/.m2/repository if [ -n "${OPA_AUTHORIZER}" ]; then \
35
+ cd trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src && \
36
+ mvn package -DskipTests; \
37
+ fi
38
+
39
+ # Create an empty dummy plugin folder for newer versions that don't need the plugin anymore
40
+ RUN mkdir -p trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src/target/out
41
+
42
+ # Not tagging base image because it is built as part of the same process
43
+ # hadolint ignore=DL3006
44
+ FROM stackable/image/java-devel AS builder
8
45
9
46
ARG PRODUCT
10
47
# External OPA authorizer only required for 414 and 428, included in 438
11
48
# The `OPA_AUTHORIZER` is not set in the conf.py for version 438 to remove the ARG as soon as 414 and 428 are removed
12
49
ARG OPA_AUTHORIZER
50
+ ARG STORAGE_CONNECTOR
51
+
52
+ WORKDIR /stackable
53
+
54
+ RUN curl --fail -L "https://repo.stackable.tech/repository/packages/trino-server/trino-server-${PRODUCT}-src.tar.gz" | tar -xzC .
55
+ RUN --mount=type=cache,target=/root/.m2/repository cd "trino-server-${PRODUCT}-src" && \
56
+ mvn package -DskipTests -Dmaven.gitcommitid.skip=true --projects="!docs"
57
+ RUN tar -xzf /stackable/trino-server-${PRODUCT}-src/core/trino-server/target/trino-server-${PRODUCT}.tar.gz -C /stackable && \
58
+ chown --recursive stackable /stackable/trino-server-${PRODUCT}
59
+
60
+ COPY --from=storage-connector-builder /stackable/trino-storage-${STORAGE_CONNECTOR}-src/target/trino-storage-${STORAGE_CONNECTOR} /stackable/trino-server-${PRODUCT}/plugin/trino-storage-${STORAGE_CONNECTOR}
61
+ # # TODO: remove the following COPY statement once Trino versions 414 and 428 are removed
62
+ COPY --from=opa-authorizer-builder /stackable/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src/target/out /stackable/trino-server-${PRODUCT}/plugin/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}
63
+ # We have no way to copy a folder conditionally, so delete the opa authorizer folder if no version is selected
64
+ # Otherwise Trino will crash since empty plugin folders are not allowed
65
+ RUN [ -n "${OPA_AUTHORIZER}" ] || rmdir /stackable/trino-server-${PRODUCT}/plugin/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}
66
+
67
+ # For earlier versions this script removes the .class file that contains the
68
+ # vulnerable code.
69
+ # TODO: This can be restricted to target only versions which do not honor the environment
70
+ # varible that has been set above but this has not currently been implemented
71
+ COPY shared/log4shell.sh /bin
72
+ RUN /bin/log4shell.sh /stackable/trino-server-${PRODUCT}
73
+
74
+ # Ensure no vulnerable files are left over
75
+ # This will currently report vulnerable files being present, as it also alerts on
76
+ # SocketNode.class, which we do not remove with our scripts.
77
+ # Further investigation will be needed whether this should also be removed.
78
+ COPY shared/log4shell_1.6.1-log4shell_Linux_x86_64 /bin/log4shell_scanner_x86_64
79
+ COPY shared/log4shell_1.6.1-log4shell_Linux_aarch64 /bin/log4shell_scanner_aarch64
80
+ COPY shared/log4shell_scanner /bin/log4shell_scanner
81
+ RUN /bin/log4shell_scanner s /stackable/trino-server-${PRODUCT}
82
+ # ===
83
+
84
+ # Not tagging base image because it is built as part of the same process
85
+ # hadolint ignore=DL3006
86
+ FROM stackable/image/java-devel AS jmx-exporter-builder
87
+
88
+ ARG JMX_EXPORTER
89
+
90
+ WORKDIR /stackable
91
+
92
+ RUN curl --fail -L "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus-${JMX_EXPORTER}-src.tar.gz" | tar -xzC .
93
+ RUN --mount=type=cache,target=/root/.m2/repository cd jmx_prometheus-${JMX_EXPORTER}-src && \
94
+ mvn package
95
+
96
+ # Not tagging base image because it is built as part of the same process
97
+ # hadolint ignore=DL3006
98
+ FROM stackable/image/java-base
99
+
100
+ ARG PRODUCT
13
101
ARG JMX_EXPORTER
14
102
ARG RELEASE
15
- ARG STORAGE_CONNECTOR
16
103
17
104
LABEL name="Trino" \
18
105
@@ -38,45 +125,16 @@ WORKDIR /stackable
38
125
COPY --chown=stackable:stackable trino/stackable /stackable
39
126
COPY --chown=stackable:stackable trino/licenses /licenses
40
127
41
- RUN curl --fail -L https://repo.stackable.tech/repository/packages/trino-server/trino-server-${PRODUCT}.tar.gz | tar -xzC . && \
42
- ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server
43
-
44
- RUN curl --fail https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar \
45
- -o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar && \
46
- chmod +x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar && \
128
+ COPY --from=builder /stackable/trino-server-${PRODUCT} /stackable/trino-server-${PRODUCT}
129
+ COPY --from=jmx-exporter-builder /stackable/jmx_prometheus-${JMX_EXPORTER}-src/jmx_prometheus_javaagent/target/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
130
+ RUN ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server && \
47
131
ln -s /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent.jar
48
132
49
- # TODO: remove the following RUN statement once Trino versions 414 and 428 are removed
50
- RUN if [[ -n ${OPA_AUTHORIZER} ]] ; then \
51
- curl --fail -L https://repo.stackable.tech/repository/packages/trino-opa-authorizer/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}.tar.gz | tar -xzC /stackable/trino-server/plugin ; \
52
- fi
53
-
54
- RUN curl --fail https://repo.stackable.tech/repository/packages/trino-storage/trino-storage-${STORAGE_CONNECTOR}.zip -o /tmp/trino-storage-${STORAGE_CONNECTOR}.zip && \
55
- unzip /tmp/trino-storage-${STORAGE_CONNECTOR}.zip -d /stackable/trino-server/plugin && \
56
- rm -f /tmp/trino-storage-${STORAGE_CONNECTOR}.zip
57
-
58
133
# ===
59
134
# Mitigation for CVE-2021-44228 (Log4Shell)
60
135
# This variable is supported as of Log4j version 2.10 and
61
136
# disables the vulnerable feature
62
137
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true
63
138
64
- # For earlier versions this script removes the .class file that contains the
65
- # vulnerable code.
66
- # TODO: This can be restricted to target only versions which do not honor the environment
67
- # varible that has been set above but this has not currently been implemented
68
- COPY shared/log4shell.sh /bin
69
- RUN /bin/log4shell.sh /stackable/trino-server-${PRODUCT}
70
-
71
- # Ensure no vulnerable files are left over
72
- # This will currently report vulnerable files being present, as it also alerts on
73
- # SocketNode.class, which we do not remove with our scripts.
74
- # Further investigation will be needed whether this should also be removed.
75
- COPY shared/log4shell_1.6.1-log4shell_Linux_x86_64 /bin/log4shell_scanner_x86_64
76
- COPY shared/log4shell_1.6.1-log4shell_Linux_aarch64 /bin/log4shell_scanner_aarch64
77
- COPY shared/log4shell_scanner /bin/log4shell_scanner
78
- RUN /bin/log4shell_scanner s /stackable/trino-server-${PRODUCT}
79
- # ===
80
-
81
139
WORKDIR /stackable/trino-server
82
140
CMD ["bin/launcher" , "run" , "--etc-dir=/stackable/conf" ]
0 commit comments