-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding docker image templates #175
base: main
Are you sure you want to change the base?
Changes from 2 commits
d6d379c
e1f9580
ca9108a
a67a4b2
1e8d2a8
cb37c9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM amazonlinux:2 | ||
{%if version_8 %} | ||
ARG version={{JDK_VERSION}} | ||
{% else %} | ||
ARG version={{CORRETTO_VERSION}} | ||
{% endif %} | ||
# In addition to installing the Amazon corretto, we also install | ||
# fontconfig. The folks who manage the docker hub's | ||
# official image library have found that font management | ||
# is a common usecase, and painpoint, and have | ||
# recommended that Java images include font support. | ||
# | ||
# See: | ||
# https://github.com/docker-library/official-images/blob/master/test/tests/java-uimanager-font/container.java | ||
|
||
# The logic and code related to Fingerprint is contributed by @tianon in a Github PR's Conversation | ||
# Comment = https://github.com/docker-library/official-images/pull/7459#issuecomment-592242757 | ||
# PR = https://github.com/docker-library/official-images/pull/7459 | ||
RUN set -eux \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
&& curl -fL -o corretto.key https://yum.corretto.aws/corretto.key \ | ||
&& gpg --batch --import corretto.key \ | ||
&& gpg --batch --export --armor '6DC3636DAE534049C8B94623A122542AB04F24E3' > corretto.key \ | ||
&& rpm --import corretto.key \ | ||
&& rm -r "$GNUPGHOME" corretto.key \ | ||
&& curl -fL -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ | ||
&& grep -q '^gpgcheck=1' /etc/yum.repos.d/corretto.repo \ | ||
&& echo "priority=9" >> /etc/yum.repos.d/corretto.repo \ | ||
{% if version_8 %} | ||
&& yum install -y java-{{JDK_VERSION}}-amazon-corretto-devel-$version \ | ||
&& (find /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto -name src.zip -delete || true) \ | ||
{% else %} | ||
&& yum install -y java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version \ | ||
&& (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -name src.zip -delete || true) \ | ||
{% endif %} | ||
&& yum install -y fontconfig \ | ||
&& yum clean all | ||
|
||
ENV LANG C.UTF-8 | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM amazonlinux:2 | ||
|
||
ARG version={{CORRETTO_VERSION}} | ||
|
||
RUN set -eux \ | ||
&& export resouce_version=$(echo $version | tr '-' '.') \ | ||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ | ||
&& echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ | ||
&& CORRETO_TEMP=$(mktemp -d) \ | ||
&& pushd ${CORRETO_TEMP} \ | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.1.$(uname -m).rpm") \ | ||
&& for rpm in ${RPM_LIST[@]}; do \ | ||
curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ | ||
&& rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ | ||
&& yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ | ||
done \ | ||
&& rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ | ||
&& popd \ | ||
&& (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ | ||
&& rm -rf ${CORRETO_TEMP} \ | ||
&& yum clean all \ | ||
&& rm -rf /var/cache/yum \ | ||
&& sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf | ||
|
||
ENV LANG C.UTF-8 | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM amazonlinux:2 | ||
|
||
ARG version={{CORRETTO_VERSION}} | ||
|
||
RUN set -eux \ | ||
&& export resouce_version=$(echo $version | tr '-' '.') \ | ||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ | ||
&& echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ | ||
&& CORRETO_TEMP=$(mktemp -d) \ | ||
&& pushd ${CORRETO_TEMP} \ | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm") \ | ||
&& for rpm in ${RPM_LIST[@]}; do \ | ||
curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ | ||
&& rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ | ||
&& yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ | ||
done \ | ||
&& rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ | ||
&& popd \ | ||
&& (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ | ||
&& rm -rf ${CORRETO_TEMP} \ | ||
&& yum clean all \ | ||
&& rm -rf /var/cache/yum \ | ||
&& sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf | ||
|
||
ENV LANG C.UTF-8 | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM amazonlinux:2 | ||
{% if version_8 %} | ||
ARG version={{JDK_VERSION}} | ||
{% else %} | ||
ARG version={{CORRETTO_VERSION}} | ||
{% endif %} | ||
|
||
RUN set -eux \ | ||
{%if version_8 %} | ||
&& export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ | ||
{% else %} | ||
&& export resouce_version=$(echo $version | tr '-' '.') \ | ||
{% endif %} | ||
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2 \ | ||
&& echo "localpkg_gpgcheck=1" >> /etc/yum.conf \ | ||
&& CORRETO_TEMP=$(mktemp -d) \ | ||
&& pushd ${CORRETO_TEMP} \ | ||
{% if jre %} | ||
&& RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ | ||
{% elif version_8 %} | ||
&& RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm" "java-{{JDK_VERSION}}-amazon-corretto-devel-$version.amzn2.$(uname -m).rpm") \ | ||
{% elif version_11 %} | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ | ||
{% else %} | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2.1.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2.1.$(uname -m).rpm") \ | ||
{% endif %} | ||
&& for rpm in ${RPM_LIST[@]}; do \ | ||
curl --fail -O https://corretto.aws/downloads/resources/${resouce_version}/${rpm} \ | ||
{% if jre %} | ||
&& echo $(rpm -K "${CORRETO_TEMP}/${rpm}") \ | ||
{% endif %} | ||
&& rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: rsa sha1 (md5) pgp md5 OK" || exit 1 \ | ||
&& if [[ ${rpm} != *jmods* ]]; then \ | ||
yum install -y $(yum deplist "${CORRETO_TEMP}/${rpm}" |grep provider | grep -vE "log4j-cve|corretto" | tr -s ' ' |cut -d ' ' -f 3 ); \ | ||
fi; \ | ||
done \ | ||
&& rpm -i --nodeps ${CORRETO_TEMP}/*.rpm \ | ||
&& popd \ | ||
{%if version_8 %} | ||
&& (find /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m) -name "*src.zip" -delete || true) \ | ||
{% else %} | ||
&& (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m) -name src.zip -delete || true) \ | ||
{% endif %} | ||
&& rm -rf ${CORRETO_TEMP} \ | ||
&& yum clean all \ | ||
&& rm -rf /var/cache/yum \ | ||
&& sed -i '/localpkg_gpgcheck=1/d' /etc/yum.conf | ||
|
||
ENV LANG C.UTF-8 | ||
{%if jre %} | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre | ||
{% else %} | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto | ||
{% endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM amazonlinux:2023 | ||
|
||
ARG version={{CORRETTO_VERSION}} | ||
# In addition to installing the Amazon corretto, we also install | ||
# libs that are needed for jdk to be functional | ||
|
||
# The logic and code related to Fingerprint is contributed by @tianon in a Github PR's Conversation | ||
# Comment = https://github.com/docker-library/official-images/pull/7459#issuecomment-592242757 | ||
# PR = https://github.com/docker-library/official-images/pull/7459 | ||
RUN set -eux \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
&& curl -fL -o corretto.key https://yum.corretto.aws/corretto.key \ | ||
&& dnf install gnupg2 -y --allowerasing \ | ||
&& dnf install findutils -y \ | ||
&& gpg --batch --import corretto.key \ | ||
&& gpg --batch --export --armor '6DC3636DAE534049C8B94623A122542AB04F24E3' > corretto.key \ | ||
&& rpm --import corretto.key \ | ||
&& rm -r "$GNUPGHOME" corretto.key \ | ||
&& curl -fL -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \ | ||
&& grep -q '^gpgcheck=1' /etc/yum.repos.d/corretto.repo \ | ||
&& echo "priority=9" >> /etc/yum.repos.d/corretto.repo \ | ||
&& dnf install -y java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version \ | ||
&& (find /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto -name src.zip -delete || true) \ | ||
&& dnf remove -y findutils \ | ||
&& dnf install -y fontconfig freetype libjpeg dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts libjpeg \ | ||
&& dnf clean all | ||
|
||
ENV LANG C.UTF-8 | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM amazonlinux:2023 | ||
|
||
ARG version={{CORRETTO_VERSION}} | ||
ARG package_version=1 | ||
|
||
RUN set -eux \ | ||
&& rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ | ||
&& echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ | ||
&& CORRETO_TEMP=$(mktemp -d) \ | ||
&& pushd ${CORRETO_TEMP} \ | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm") \ | ||
&& for rpm in ${RPM_LIST[@]}; do \ | ||
curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ | ||
&& rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ | ||
done \ | ||
&& dnf install -y ${CORRETO_TEMP}/*.rpm \ | ||
&& popd \ | ||
&& rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ | ||
&& rm -rf ${CORRETO_TEMP} \ | ||
&& dnf clean all \ | ||
&& sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf | ||
|
||
ENV LANG C.UTF-8 | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM amazonlinux:{{OS_VERSION}} | ||
|
||
ARG version={{CORRETTO_VERSION}} | ||
ARG package_version=1 | ||
|
||
RUN set -eux \ | ||
&& rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ | ||
&& echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ | ||
&& CORRETO_TEMP=$(mktemp -d) \ | ||
&& pushd ${CORRETO_TEMP} \ | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm") \ | ||
&& for rpm in ${RPM_LIST[@]}; do \ | ||
curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ | ||
&& rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ | ||
done \ | ||
&& dnf install -y ${CORRETO_TEMP}/*.rpm \ | ||
&& popd \ | ||
&& rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ | ||
&& rm -rf ${CORRETO_TEMP} \ | ||
&& dnf clean all \ | ||
&& sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf | ||
|
||
ENV LANG C.UTF-8 | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM amazonlinux:2023 | ||
{% if version_8 %} | ||
ARG version={{JDK_VERSION}} | ||
{% else %} | ||
ARG version={{CORRETTO_VERSION}} | ||
{% endif %} | ||
ARG package_version=1 | ||
|
||
RUN set -eux \ | ||
{%if version_8 %} | ||
&& export resouce_version=$(echo $version | tr '-' '.' | tr '_' '.'| tr -d "b" | awk -F. '{print $2"."$4"."$5"."$6}') \ | ||
{% endif %} | ||
&& rpm --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 \ | ||
&& echo "localpkg_gpgcheck=1" >> /etc/dnf/dnf.conf \ | ||
&& CORRETO_TEMP=$(mktemp -d) \ | ||
&& pushd ${CORRETO_TEMP} \ | ||
{% if jre %} | ||
&& RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2.$(uname -m).rpm") \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would simplify the code if you eliminate JDK_VERSION and just set MAJOR_VERSION to 1.8.0 when its 8. Is that possible or are those values too overloaded? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can try that and see if everything builds correctly |
||
{% elif version_8 %} | ||
&& RPM_LIST=("java-{{JDK_VERSION}}-amazon-corretto-$version.amzn2023.$(uname -m).rpm" "java-{{JDK_VERSION}}-amazon-corretto-devel-$version.amzn2023.$(uname -m).rpm") \ | ||
{% else %} | ||
&& RPM_LIST=("java-{{MAJOR_VERSION}}-amazon-corretto-headless-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-devel-$version.amzn2023.${package_version}.$(uname -m).rpm" "java-{{MAJOR_VERSION}}-amazon-corretto-jmods-$version.amzn2023.${package_version}.$(uname -m).rpm") \ | ||
{% endif %} | ||
&& for rpm in ${RPM_LIST[@]}; do \ | ||
curl --fail -O https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/${rpm} \ | ||
&& rpm -K "${CORRETO_TEMP}/${rpm}" | grep -F "${CORRETO_TEMP}/${rpm}: digests signatures OK" || exit 1; \ | ||
done \ | ||
&& dnf install -y ${CORRETO_TEMP}/*.rpm \ | ||
{% if jre %} | ||
&& alternatives --install /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto java-{{JDK_VERSION}}-amazon-corretto /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m) 100 \ | ||
&& popd \ | ||
{%if version_8 %} | ||
&& rm -rf /usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ | ||
{% else %} | ||
&& rm -rf /usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto.$(uname -m)/lib/src.zip \ | ||
{% endif %} | ||
&& rm -rf ${CORRETO_TEMP} \ | ||
&& dnf clean all \ | ||
{% if version_8 %} | ||
&& rm -rf /var/cache/yum \ | ||
{% endif %} | ||
&& sed -i '/localpkg_gpgcheck=1/d' /etc/dnf/dnf.conf | ||
|
||
ENV LANG C.UTF-8 | ||
{%if jre %} | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{JDK_VERSION}}-amazon-corretto/jre | ||
{% else %} | ||
ENV JAVA_HOME=/usr/lib/jvm/java-{{MAJOR_VERSION}}-amazon-corretto | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think when it is JDK8 you need to use 1.8.0 for the java_home and not just the major_version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right I will fix it