@@ -94,13 +94,15 @@ RUN set -eux; \
94
94
gnupg \
95
95
; \
96
96
{{ ) else ( -}}
97
+ {{ if is_yum then ( -}}
97
98
# http://yum.baseurl.org/wiki/YumDB.html
98
99
if ! command -v yumdb > /dev/null; then \
99
100
yum install -y --setopt=skip_missing_names_on_install=False yum-utils; \
100
101
yumdb set reason dep yum-utils; \
101
102
fi; \
102
- # a helper function to "yum install" things, but only if they aren't installed (and to set their "reason" to "dep" so "yum autoremove" can purge them for us)
103
- _yum_install_temporary() { ( set -eu +x; \
103
+ {{ ) else "" end -}}
104
+ # a helper function to install things, but only if they aren't installed (and to set their "reason" to "dep" so "autoremove" can purge them for us)
105
+ _install_temporary() { ( set -eu +x; \
104
106
local pkg todo=''; \
105
107
for pkg; do \
106
108
if ! rpm --query "$pkg" > /dev/null 2>&1; then \
@@ -109,11 +111,21 @@ RUN set -eux; \
109
111
done; \
110
112
if [ -n "$todo" ]; then \
111
113
set -x; \
114
+ {{ if is_yum then ( -}}
112
115
yum install -y --setopt=skip_missing_names_on_install=False $todo; \
113
116
yumdb set reason dep $todo; \
117
+ {{ ) else ( -}}
118
+ dnf install -y $todo; \
119
+ dnf mark remove $todo; \
120
+ {{ ) end -}}
114
121
fi; \
115
122
) }; \
116
- _yum_install_temporary gzip tar; \
123
+ _install_temporary gzip tar; \
124
+ {{ if vendor_variant | contains("al20") then ( -}}
125
+ # gnupg2-minimal (installed by default) conflicts with gnupg2 and does not include dirmngr so cannot fetch keys
126
+ dnf install -y --allowerasing gnupg2; \
127
+ {{ ) else "" end -}}
128
+
117
129
{{ ) end -}}
118
130
\
119
131
ddist() { \
@@ -173,11 +185,16 @@ RUN set -eux; \
173
185
make \
174
186
; \
175
187
{{ ) else ( -}}
176
- _yum_install_temporary \
188
+ _install_temporary \
177
189
apr-devel \
190
+ findutils \
178
191
gcc \
179
192
make \
193
+ {{ if vendor_variant | variant_is_al2 then ( -}}
180
194
openssl11-devel \
195
+ {{ ) else ( -}}
196
+ openssl-devel \
197
+ {{ ) end -}}
181
198
; \
182
199
{{ ) end -}}
183
200
( \
@@ -206,6 +223,10 @@ RUN set -eux; \
206
223
rm -rf "$nativeBuildDir"; \
207
224
rm bin/tomcat-native.tar.gz; \
208
225
\
226
+ # sh removes env vars it doesn't support (ones with periods)
227
+ # https://github.com/docker-library/tomcat/issues/77
228
+ find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' +; \
229
+ \
209
230
{{ if is_apt then ( -}}
210
231
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
211
232
apt-mark auto '.*' > /dev/null; \
@@ -232,19 +253,15 @@ RUN set -eux; \
232
253
| xargs -rt rpm --query --whatprovides \
233
254
| sort -u \
234
255
| tee "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt" \
235
- | xargs -r yumdb set reason user \
256
+ | xargs -r {{ if is_yum then " yumdb set reason user" else "dnf mark install" end }} \
236
257
; \
237
258
\
238
259
# clean up anything added temporarily and not later marked as necessary
239
- yum autoremove -y; \
240
- yum clean all; \
241
- rm -rf /var/cache/yum; \
260
+ {{ if is_yum then " yum" else "dnf" end }} autoremove -y; \
261
+ {{ if is_yum then " yum" else "dnf" end }} clean all; \
262
+ rm -rf /var/cache/{{ if is_yum then " yum" else "dnf" end }} ; \
242
263
{{ ) end -}}
243
264
\
244
- # sh removes env vars it doesn't support (ones with periods)
245
- # https://github.com/docker-library/tomcat/issues/77
246
- find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' +; \
247
- \
248
265
# fix permissions (especially for running as non-root)
249
266
# https://github.com/docker-library/tomcat/issues/35
250
267
chmod -R +rX .; \
@@ -260,9 +277,9 @@ RUN set -eux; \
260
277
xargs -rt apt-get install -y --no-install-recommends < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \
261
278
rm -rf /var/lib/apt/lists/*
262
279
{{ ) else ( -}}
263
- xargs -rt yum install -y --setopt=skip_missing_names_on_install=False < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \
264
- yum clean all; \
265
- rm -rf /var/cache/yum
280
+ xargs -rt {{ if is_yum then " yum" else "dnf" end }} install -y{{ if is_yum then " --setopt=skip_missing_names_on_install=False" else "" end }} < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \
281
+ {{ if is_yum then " yum" else "dnf" end }} clean all; \
282
+ rm -rf /var/cache/{{ if is_yum then " yum" else "dnf" end }}
266
283
{{ ) end -}}
267
284
{{ ) end -}}
268
285
0 commit comments