@@ -94,13 +94,15 @@ RUN set -eux; \
9494 gnupg \
9595 ; \
9696{{ ) else ( -}}
97+ {{ if is_yum then ( -}}
9798# http://yum.baseurl.org/wiki/YumDB.html
9899 if ! command -v yumdb > /dev/null; then \
99100 yum install -y --setopt=skip_missing_names_on_install=False yum-utils; \
100101 yumdb set reason dep yum-utils; \
101102 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; \
104106 local pkg todo=''; \
105107 for pkg; do \
106108 if ! rpm --query "$pkg" > /dev/null 2>&1; then \
@@ -109,11 +111,21 @@ RUN set -eux; \
109111 done; \
110112 if [ -n "$todo" ]; then \
111113 set -x; \
114+ {{ if is_yum then ( -}}
112115 yum install -y --setopt=skip_missing_names_on_install=False $todo; \
113116 yumdb set reason dep $todo; \
117+ {{ ) else ( -}}
118+ dnf install -y $todo; \
119+ dnf mark remove $todo; \
120+ {{ ) end -}}
114121 fi; \
115122 ) }; \
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+
117129{{ ) end -}}
118130 \
119131 ddist() { \
@@ -173,11 +185,16 @@ RUN set -eux; \
173185 make \
174186 ; \
175187{{ ) else ( -}}
176- _yum_install_temporary \
188+ _install_temporary \
177189 apr-devel \
190+ findutils \
178191 gcc \
179192 make \
193+ {{ if vendor_variant | variant_is_al2 then ( -}}
180194 openssl11-devel \
195+ {{ ) else ( -}}
196+ openssl-devel \
197+ {{ ) end -}}
181198 ; \
182199{{ ) end -}}
183200 ( \
@@ -206,6 +223,10 @@ RUN set -eux; \
206223 rm -rf "$nativeBuildDir"; \
207224 rm bin/tomcat-native.tar.gz; \
208225 \
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+ \
209230{{ if is_apt then ( -}}
210231# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
211232 apt-mark auto '.*' > /dev/null; \
@@ -232,19 +253,15 @@ RUN set -eux; \
232253 | xargs -rt rpm --query --whatprovides \
233254 | sort -u \
234255 | 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 }} \
236257 ; \
237258 \
238259# 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 }} ; \
242263{{ ) end -}}
243264 \
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- \
248265# fix permissions (especially for running as non-root)
249266# https://github.com/docker-library/tomcat/issues/35
250267 chmod -R +rX .; \
@@ -260,9 +277,9 @@ RUN set -eux; \
260277 xargs -rt apt-get install -y --no-install-recommends < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \
261278 rm -rf /var/lib/apt/lists/*
262279{{ ) 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 }}
266283{{ ) end -}}
267284{{ ) end -}}
268285
0 commit comments