Skip to content

Commit

Permalink
Adjust template for al2023
Browse files Browse the repository at this point in the history
  • Loading branch information
yosifkit committed Sep 29, 2023
1 parent 7adbec0 commit a40c1c3
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 19 deletions.
47 changes: 32 additions & 15 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ RUN set -eux; \
gnupg \
; \
{{ ) else ( -}}
{{ if is_yum then ( -}}
# http://yum.baseurl.org/wiki/YumDB.html
if ! command -v yumdb > /dev/null; then \
yum install -y --setopt=skip_missing_names_on_install=False yum-utils; \
yumdb set reason dep yum-utils; \
fi; \
# 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)
_yum_install_temporary() { ( set -eu +x; \
{{ ) else "" end -}}
# 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)
_install_temporary() { ( set -eu +x; \
local pkg todo=''; \
for pkg; do \
if ! rpm --query "$pkg" > /dev/null 2>&1; then \
Expand All @@ -109,11 +111,21 @@ RUN set -eux; \
done; \
if [ -n "$todo" ]; then \
set -x; \
{{ if is_yum then ( -}}
yum install -y --setopt=skip_missing_names_on_install=False $todo; \
yumdb set reason dep $todo; \
{{ ) else ( -}}
dnf install -y $todo; \
dnf mark remove $todo; \
{{ ) end -}}
fi; \
) }; \
_yum_install_temporary gzip tar; \
_install_temporary gzip tar; \
{{ if vendor_variant | contains("al20") then ( -}}
# gnupg2-minimal (installed by default) conflicts with gnupg2 and does not include dirmngr so cannot fetch keys
dnf install -y --allowerasing gnupg2; \
{{ ) else "" end -}}

{{ ) end -}}
\
ddist() { \
Expand Down Expand Up @@ -173,11 +185,16 @@ RUN set -eux; \
make \
; \
{{ ) else ( -}}
_yum_install_temporary \
_install_temporary \
apr-devel \
findutils \
gcc \
make \
{{ if vendor_variant | variant_is_al2 then ( -}}
openssl11-devel \
{{ ) else ( -}}
openssl-devel \
{{ ) end -}}
; \
{{ ) end -}}
( \
Expand Down Expand Up @@ -206,6 +223,10 @@ RUN set -eux; \
rm -rf "$nativeBuildDir"; \
rm bin/tomcat-native.tar.gz; \
\
# sh removes env vars it doesn't support (ones with periods)
# https://github.com/docker-library/tomcat/issues/77
find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' +; \
\
{{ if is_apt then ( -}}
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
Expand All @@ -232,19 +253,15 @@ RUN set -eux; \
| xargs -rt rpm --query --whatprovides \
| sort -u \
| tee "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt" \
| xargs -r yumdb set reason user \
| xargs -r {{ if is_yum then "yumdb set reason user" else "dnf mark install" end }} \
; \
\
# clean up anything added temporarily and not later marked as necessary
yum autoremove -y; \
yum clean all; \
rm -rf /var/cache/yum; \
{{ if is_yum then "yum" else "dnf" end }} autoremove -y; \
{{ if is_yum then "yum" else "dnf" end }} clean all; \
rm -rf /var/cache/{{ if is_yum then "yum" else "dnf" end }}; \
{{ ) end -}}
\
# sh removes env vars it doesn't support (ones with periods)
# https://github.com/docker-library/tomcat/issues/77
find ./bin/ -name '*.sh' -exec sed -ri 's|^#!/bin/sh$|#!/usr/bin/env bash|' '{}' +; \
\
# fix permissions (especially for running as non-root)
# https://github.com/docker-library/tomcat/issues/35
chmod -R +rX .; \
Expand All @@ -260,9 +277,9 @@ RUN set -eux; \
xargs -rt apt-get install -y --no-install-recommends < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \
rm -rf /var/lib/apt/lists/*
{{ ) else ( -}}
xargs -rt yum install -y --setopt=skip_missing_names_on_install=False < "$TOMCAT_NATIVE_LIBDIR/.dependencies.txt"; \
yum clean all; \
rm -rf /var/cache/yum
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"; \
{{ if is_yum then "yum" else "dnf" end }} clean all; \
rm -rf /var/cache/{{ if is_yum then "yum" else "dnf" end }}
{{ ) end -}}
{{ ) end -}}

Expand Down
10 changes: 9 additions & 1 deletion shared.jq
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ def is_supported_java_version(java):
java >= 7
end
;
def variant_is_al2: # NOT al20XX
contains("al2") and (contains("al20") | not)
;
def is_yum:
vendor_variant | (
variant_is_al2
)
;
def is_apt:
vendor_variant | (
contains("al2")
Expand All @@ -33,7 +41,7 @@ def has_openssl_ge_3(variant):
# https://github.com/apache/tomcat-native/commit/f7930fa16f095717cfc641a8d24e60c343765adc
variant | (
# amazonlinux
contains("al2") # corretto
variant_is_al2 # corretto
# debian
or contains("bullseye") # openjdk
or contains("buster") # openjdk
Expand Down
19 changes: 17 additions & 2 deletions versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,73 @@
"10.1": {
"sha512": "406c0c367ac6ad95bb724ecc3a3c340ad7ded8c62287d657811eeec496eaaca1f5add52d2f46111da1426ae67090c543f6deccfeb5fdf4bdae32f9b39e773265",
"variants": [
"jdk21/corretto-al2023",
"jdk17/temurin-jammy",
"jre17/temurin-jammy",
"jdk17/corretto-al2023",
"jdk11/temurin-jammy",
"jre11/temurin-jammy"
"jre11/temurin-jammy",
"jdk11/corretto-al2023"
],
"version": "10.1.13"
},
"11.0": {
"sha512": "0404346b353030f776448af8ae4495d45c4c73c27bf9a9bfa5c53508ec51b0200e93e21f5526a28856639127fc20cc546e880908ef182b1653e5fd5ddb056fc5",
"variants": [],
"variants": [
"jdk21/corretto-al2023"
],
"version": "11.0.0-M11"
},
"8.5": {
"sha512": "fdd9bd768c2c8b7f57c75f1a4863bd2bde55e8ea7c8b9cb81427ea8be652540bdcb1ff1cd625b9fb0dd48eb750ebef0f0244d12ac574998d5df3a0d339699bcc",
"variants": [
"jdk21/corretto-al2023",
"jdk21/corretto-al2",
"jdk17/temurin-jammy",
"jre17/temurin-jammy",
"jdk17/temurin-focal",
"jre17/temurin-focal",
"jdk17/corretto-al2023",
"jdk17/corretto-al2",
"jdk11/temurin-jammy",
"jre11/temurin-jammy",
"jdk11/temurin-focal",
"jre11/temurin-focal",
"jdk11/corretto-al2023",
"jdk11/corretto-al2",
"jdk8/temurin-jammy",
"jre8/temurin-jammy",
"jdk8/temurin-focal",
"jre8/temurin-focal",
"jdk8/corretto-al2023",
"jre8/corretto-al2023",
"jdk8/corretto-al2"
],
"version": "8.5.93"
},
"9.0": {
"sha512": "24014441b0ccdd2dda238efa56e1a039476488943e6cf04f8a372a340a49dd21ce174ed68e2f5fcc43401e85fae6d00c5eac3d357653e91601737b6fa94476de",
"variants": [
"jdk21/corretto-al2023",
"jdk21/corretto-al2",
"jdk17/temurin-jammy",
"jre17/temurin-jammy",
"jdk17/temurin-focal",
"jre17/temurin-focal",
"jdk17/corretto-al2023",
"jdk17/corretto-al2",
"jdk11/temurin-jammy",
"jre11/temurin-jammy",
"jdk11/temurin-focal",
"jre11/temurin-focal",
"jdk11/corretto-al2023",
"jdk11/corretto-al2",
"jdk8/temurin-jammy",
"jre8/temurin-jammy",
"jdk8/temurin-focal",
"jre8/temurin-focal",
"jdk8/corretto-al2023",
"jre8/corretto-al2023",
"jdk8/corretto-al2"
],
"version": "9.0.80"
Expand Down
2 changes: 1 addition & 1 deletion versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for javaVersion in 21 17 11 8; do
for vendorVariant in \
temurin-{jammy,focal} \
openjdk{,-slim}-{bookworm,bullseye,buster} \
corretto-al2 \
corretto-al2023 corretto-al2 \
; do
for javaVariant in {jdk,jre}"$javaVersion"; do
export variant="$javaVariant/$vendorVariant"
Expand Down

0 comments on commit a40c1c3

Please sign in to comment.