Skip to content

Commit a40c1c3

Browse files
committed
Adjust template for al2023
1 parent 7adbec0 commit a40c1c3

File tree

4 files changed

+59
-19
lines changed

4 files changed

+59
-19
lines changed

Dockerfile.template

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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

shared.jq

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ def is_supported_java_version(java):
1818
java >= 7
1919
end
2020
;
21+
def variant_is_al2: # NOT al20XX
22+
contains("al2") and (contains("al20") | not)
23+
;
24+
def is_yum:
25+
vendor_variant | (
26+
variant_is_al2
27+
)
28+
;
2129
def is_apt:
2230
vendor_variant | (
2331
contains("al2")
@@ -33,7 +41,7 @@ def has_openssl_ge_3(variant):
3341
# https://github.com/apache/tomcat-native/commit/f7930fa16f095717cfc641a8d24e60c343765adc
3442
variant | (
3543
# amazonlinux
36-
contains("al2") # corretto
44+
variant_is_al2 # corretto
3745
# debian
3846
or contains("bullseye") # openjdk
3947
or contains("buster") # openjdk

versions.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,73 @@
22
"10.1": {
33
"sha512": "406c0c367ac6ad95bb724ecc3a3c340ad7ded8c62287d657811eeec496eaaca1f5add52d2f46111da1426ae67090c543f6deccfeb5fdf4bdae32f9b39e773265",
44
"variants": [
5+
"jdk21/corretto-al2023",
56
"jdk17/temurin-jammy",
67
"jre17/temurin-jammy",
8+
"jdk17/corretto-al2023",
79
"jdk11/temurin-jammy",
8-
"jre11/temurin-jammy"
10+
"jre11/temurin-jammy",
11+
"jdk11/corretto-al2023"
912
],
1013
"version": "10.1.13"
1114
},
1215
"11.0": {
1316
"sha512": "0404346b353030f776448af8ae4495d45c4c73c27bf9a9bfa5c53508ec51b0200e93e21f5526a28856639127fc20cc546e880908ef182b1653e5fd5ddb056fc5",
14-
"variants": [],
17+
"variants": [
18+
"jdk21/corretto-al2023"
19+
],
1520
"version": "11.0.0-M11"
1621
},
1722
"8.5": {
1823
"sha512": "fdd9bd768c2c8b7f57c75f1a4863bd2bde55e8ea7c8b9cb81427ea8be652540bdcb1ff1cd625b9fb0dd48eb750ebef0f0244d12ac574998d5df3a0d339699bcc",
1924
"variants": [
25+
"jdk21/corretto-al2023",
2026
"jdk21/corretto-al2",
2127
"jdk17/temurin-jammy",
2228
"jre17/temurin-jammy",
2329
"jdk17/temurin-focal",
2430
"jre17/temurin-focal",
31+
"jdk17/corretto-al2023",
2532
"jdk17/corretto-al2",
2633
"jdk11/temurin-jammy",
2734
"jre11/temurin-jammy",
2835
"jdk11/temurin-focal",
2936
"jre11/temurin-focal",
37+
"jdk11/corretto-al2023",
3038
"jdk11/corretto-al2",
3139
"jdk8/temurin-jammy",
3240
"jre8/temurin-jammy",
3341
"jdk8/temurin-focal",
3442
"jre8/temurin-focal",
43+
"jdk8/corretto-al2023",
44+
"jre8/corretto-al2023",
3545
"jdk8/corretto-al2"
3646
],
3747
"version": "8.5.93"
3848
},
3949
"9.0": {
4050
"sha512": "24014441b0ccdd2dda238efa56e1a039476488943e6cf04f8a372a340a49dd21ce174ed68e2f5fcc43401e85fae6d00c5eac3d357653e91601737b6fa94476de",
4151
"variants": [
52+
"jdk21/corretto-al2023",
4253
"jdk21/corretto-al2",
4354
"jdk17/temurin-jammy",
4455
"jre17/temurin-jammy",
4556
"jdk17/temurin-focal",
4657
"jre17/temurin-focal",
58+
"jdk17/corretto-al2023",
4759
"jdk17/corretto-al2",
4860
"jdk11/temurin-jammy",
4961
"jre11/temurin-jammy",
5062
"jdk11/temurin-focal",
5163
"jre11/temurin-focal",
64+
"jdk11/corretto-al2023",
5265
"jdk11/corretto-al2",
5366
"jdk8/temurin-jammy",
5467
"jre8/temurin-jammy",
5568
"jdk8/temurin-focal",
5669
"jre8/temurin-focal",
70+
"jdk8/corretto-al2023",
71+
"jre8/corretto-al2023",
5772
"jdk8/corretto-al2"
5873
],
5974
"version": "9.0.80"

versions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ for javaVersion in 21 17 11 8; do
3131
for vendorVariant in \
3232
temurin-{jammy,focal} \
3333
openjdk{,-slim}-{bookworm,bullseye,buster} \
34-
corretto-al2 \
34+
corretto-al2023 corretto-al2 \
3535
; do
3636
for javaVariant in {jdk,jre}"$javaVersion"; do
3737
export variant="$javaVariant/$vendorVariant"

0 commit comments

Comments
 (0)