Skip to content

Commit

Permalink
Add Corretto images using native AL2 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lutkerd committed Sep 12, 2022
1 parent 85b940c commit a98dfd3
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 24 deletions.
50 changes: 47 additions & 3 deletions .github/workflows/verify-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Verify Docker Images

on: [push, pull_request]

jobs:
jobs:
verify-corretto:
name: Verify Corretto JDK Images
runs-on: ubuntu-latest
Expand Down Expand Up @@ -30,7 +30,51 @@ jobs:
uses: actions/checkout@v2
- name: Test Corretto ${{ matrix.version }} jre package on ${{ matrix.platform }}
run: ./bin/test-image.sh "${{ matrix.version }}/jdk/alpine/${{ matrix.os_version }}/Dockerfile" ${{ matrix.version }} jdk
- name: Test Corretto JRE
- name: Test Corretto JRE
if : ${{ matrix.version == '8' }}
run: ./bin/test-image.sh "${{ matrix.version }}/jre/alpine/${{ matrix.os_version }}/Dockerfile" ${{ matrix.version }} jre

verify-corretto-devel-al:
name: Verify Corretto Devel Images for AmazonLinux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [ 8, 11, 17 ]
package: [ jdk ]
platform: [ al2-devel ]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Test Corretto ${{ matrix.version }} ${{ matrix.package }} package on ${{ matrix.platform }}
run: ./bin/test-image.sh "${{ matrix.version }}/${{ matrix.package }}/${{ matrix.platform }}/Dockerfile" ${{ matrix.version }} jre
- name: Test Corretto ${{ matrix.version }} ${{ matrix.package }} package on ${{ matrix.platform }}
if : ${{ matrix.platform == 'al2-devel' }}
run: ./bin/test-image.sh "${{ matrix.version }}/${{ matrix.package }}/${{ matrix.platform }}/Dockerfile" ${{ matrix.version }} jdk
verify-corretto-headless-al:
name: Verify Corretto Headful Images for AmazonLinux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [ 8, 17 ]
package: [ jdk ]
platform: [ al2-headful ]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Test Corretto ${{ matrix.version }} ${{ matrix.package }} package on ${{ matrix.platform }}
run: ./bin/test-image.sh "${{ matrix.version }}/${{ matrix.package }}/${{ matrix.platform }}/Dockerfile" ${{ matrix.version }} jre
verify-corretto-headful-al:
name: Verify Corretto Headless Images for AmazonLinux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [ 11, 17 ]
package: [ jdk ]
platform: [ al2-headless ]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Test Corretto ${{ matrix.version }} ${{ matrix.package }} package on ${{ matrix.platform }}
run: ./bin/test-image.sh "${{ matrix.version }}/${{ matrix.package }}/${{ matrix.platform }}/Dockerfile" ${{ matrix.version }} jre
103 changes: 84 additions & 19 deletions .tags
Original file line number Diff line number Diff line change
@@ -1,39 +1,104 @@
Tags: 8, 8u302, 8u302-al2, 8-al2-full,8-al2-jdk, latest
Tags: 8, 8u342, 8u342-al2, 8-al2-full, 8-al2-jdk, latest
Architectures: amd64, arm64v8
Directory: 8/jdk/al2

Tags: 11, 11.0.12, 11.0.12-al2, 11-al2-jdk, 11-al2-full
Tags: 8-al2-headful, 8u342-al2-headful
Architectures: amd64, arm64v8
Directory: 11/jdk/al2
Directory: 8/jdk/al2-headful

Tags: 8-al2-devel, 8u342-al2-devel
Architectures: amd64, arm64v8
Directory: 8/jdk/al2-devel

Tags: 8-alpine3.13, 8u342-alpine3.13, 8-alpine3.13-full, 8-alpine3.13-jdk
Architectures: amd64
Directory: 8/jdk/alpine/3.13

Tags: 8-alpine, 8u302-alpine, 8-alpine-full, 8-alpine-jdk
Tags: 8-alpine3.13-jre, 8u342-alpine3.13-jre
Architectures: amd64
Directory: 8/jdk/alpine
Directory: 8/jre/alpine/3.13

Tags: 8-alpine-jre, 8u302-alpine-jre
Tags: 8-alpine3.14, 8u342-alpine3.14, 8-alpine3.14-full, 8-alpine3.14-jdk
Architectures: amd64
Directory: 8/jre/alpine
Directory: 8/jdk/alpine/3.14

Tags: 11-alpine, 11.0.12-alpine, 11-alpine-full, 11-alpine-jdk
Tags: 8-alpine3.14-jre, 8u342-alpine3.14-jre
Architectures: amd64
Directory: 11/jdk/alpine
Directory: 8/jre/alpine/3.14

Tags: 11-alpine-jre, 11.0.12-alpine-jre
Tags: 8-alpine3.15, 8u342-alpine3.15, 8-alpine3.15-full, 8-alpine3.15-jdk, 8-alpine, 8u342-alpine, 8-alpine-full, 8-alpine-jdk
Architectures: amd64
Directory: 11/jre/alpine
Directory: 8/jdk/alpine/3.15

Tags: 8-alpine3.15-jre, 8u342-alpine3.15-jre, 8-alpine-jre, 8u342-alpine-jre
Architectures: amd64
Directory: 8/jre/alpine/3.15

Tags: 11, 11.0.16, 11.0.16-al2, 11-al2-full, 11-al2-jdk
Architectures: amd64, arm64v8
Directory: 11/jdk/al2

Tags: 16, 16.0.2, 16.0.2-al2, 16-al2-jdk, 16-al2-full
Tags: 11-al2-headless, 11.0.16-al2-headless
Architectures: amd64, arm64v8
Directory: 16/jdk/al2
Directory: 11/jdk/al2-headless

Tags: 16-slim, 16.0.2, 16.0.2-al2-slim
Tags: 11-al2-devel, 11.0.16-al2-devel
Architectures: amd64, arm64v8
Directory: 16/slim/al2
Directory: 11/jdk/al2-devel

Tags: 11-alpine3.13, 11.0.16-alpine3.13, 11-alpine3.13-full, 11-alpine3.13-jdk
Architectures: amd64
Directory: 11/jdk/alpine/3.13

Tags: 16-alpine, 16.0.2-alpine, 16-alpine-full, 16-alpine-jdk
Tags: 11-alpine3.14, 11.0.16-alpine3.14, 11-alpine3.14-full, 11-alpine3.14-jdk
Architectures: amd64
Directory: 16/jdk/alpine
Directory: 11/jdk/alpine/3.14

Tags: 16-alpine-slim, 16.0.2-alpine-slim
Tags: 11-alpine3.15, 11.0.16-alpine3.15, 11-alpine3.15-full, 11-alpine3.15-jdk, 11-alpine, 11.0.16-alpine, 11-alpine-full, 11-alpine-jdk
Architectures: amd64
Directory: 16/slim/alpine
Directory: 11/jdk/alpine/3.15

Tags: 17, 17.0.4, 17.0.4-al2, 17-al2-full, 17-al2-jdk
Architectures: amd64, arm64v8
Directory: 17/jdk/al2

Tags: 17-al2-headless, 17.0.4-al2-headless
Architectures: amd64, arm64v8
Directory: 17/jdk/al2-headless

Tags: 17-al2-headful, 17.0.4-al2-headful
Architectures: amd64, arm64v8
Directory: 17/jdk/al2-headful

Tags: 17-al2-devel, 17.0.4-al2-devel
Architectures: amd64, arm64v8
Directory: 17/jdk/al2-devel

Tags: 17-alpine3.13, 17.0.4-alpine3.13, 17-alpine3.13-full, 17-alpine3.13-jdk
Architectures: amd64
Directory: 17/jdk/alpine/3.13

Tags: 17-alpine3.14, 17.0.4-alpine3.14, 17-alpine3.14-full, 17-alpine3.14-jdk
Architectures: amd64
Directory: 17/jdk/alpine/3.14

Tags: 17-alpine3.15, 17.0.4-alpine3.15, 17-alpine3.15-full, 17-alpine3.15-jdk, 17-alpine, 17.0.4-alpine, 17-alpine-full, 17-alpine-jdk
Architectures: amd64
Directory: 17/jdk/alpine/3.15

Tags: 18, 18.0.2, 18.0.2-al2, 18-al2-full, 18-al2-jdk
Architectures: amd64, arm64v8
Directory: 18/jdk/al2

Tags: 18-alpine3.13, 18.0.2-alpine3.13, 18-alpine3.13-full, 18-alpine3.13-jdk
Architectures: amd64
Directory: 18/jdk/alpine/3.13

Tags: 18-alpine3.14, 18.0.2-alpine3.14, 18-alpine3.14-full, 18-alpine3.14-jdk
Architectures: amd64
Directory: 18/jdk/alpine/3.14

Tags: 18-alpine3.15, 18.0.2-alpine3.15, 18-alpine3.15-full, 18-alpine3.15-jdk, 18-alpine, 18.0.2-alpine, 18-alpine-full, 18-alpine-jdk
Architectures: amd64
Directory: 18/jdk/alpine/3.15

16 changes: 16 additions & 0 deletions 11/jdk/al2-devel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=11.0.16.9-1

# 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 \
&& yum install -y $(yum deplist java-11-amazon-corretto-headless |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.' |tr '_' '.' |tr -d 'b' |awk -F. '{print $2"."$4"."$5"."$6}')/java-11-amazon-corretto-headless-$version.amzn2.$(uname -m).rpm \
&& yum install -y https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.' |tr '_' '.' |tr -d 'b' |awk -F. '{print $2"."$4"."$5"."$6}')/java-11-amazon-corretto-$version.amzn2.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-11-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto
16 changes: 16 additions & 0 deletions 11/jdk/al2-headless/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=11.0.16.9-1

# 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 \
&& yum install -y $(yum deplist java-11-amazon-corretto-headless |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-11-amazon-corretto-headless-$version.amzn2.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-11-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all \
&& rm -rf /var/cache/yum

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto
16 changes: 16 additions & 0 deletions 17/jdk/al2-devel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=17.0.4.9-1

# 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 \
&& yum install -y $(yum deplist java-17-amazon-corretto-headless |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-17-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm \
&& yum install -y https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-17-amazon-corretto-$version.amzn2.1.$(uname -m).rpm https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-17-amazon-corretto-devel-$version.amzn2.1.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-17-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto
16 changes: 16 additions & 0 deletions 17/jdk/al2-headful/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=17.0.4.9-1

# 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 \
&& yum install -y $(yum deplist java-17-amazon-corretto-headless |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-17-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm \
&& yum install -y https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-17-amazon-corretto-$version.amzn2.1.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-17-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto
16 changes: 16 additions & 0 deletions 17/jdk/al2-headless/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=17.0.4.9-1

# 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 \
&& yum install -y $(yum deplist java-17-amazon-corretto-headless |grep provider | grep -v log4j-cve | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.')/java-17-amazon-corretto-headless-$version.amzn2.1.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-17-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all \
&& rm -rf /var/cache/yum

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto
16 changes: 16 additions & 0 deletions 8/jdk/al2-devel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=1.8.0_342.b07-4

# 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 \
&& yum install -y $(yum deplist java-1.8.0-amazon-corretto |grep provider | grep -Ev "(log4j-cve|amazon-corretto)" | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.' |tr '_' '.' |tr -d 'b' |awk -F. '{print $2"."$4"."$5"."$6}')/java-1.8.0-amazon-corretto-$version.amzn2.$(uname -m).rpm \
&& yum install -y https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.' |tr '_' '.' |tr -d 'b' |awk -F. '{print $2"."$4"."$5"."$6}')/java-1.8.0-amazon-corretto-devel-$version.amzn2.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-1.8.0-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
16 changes: 16 additions & 0 deletions 8/jdk/al2-headful/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2

ARG version=1.8.0_342.b07-4

# 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 \
&& yum install -y $(yum deplist java-1.8.0-amazon-corretto |grep "provider" | grep -Ev "(log4j-cve|amazon-corretto)" | tr -s ' ' |cut -d ' ' -f 3 ) \
&& rpm -i --nodeps https://corretto.aws/downloads/resources/$(echo $version | tr '-' '.' |tr '_' '.' |tr -d 'b' |awk -F. '{print $2"."$4"."$5"."$6}')/java-1.8.0-amazon-corretto-$version.amzn2.$(uname -m).rpm \
&& (find /usr/lib/jvm/java-1.8.0-amazon-corretto.$(uname -m) -name src.zip -delete || true) \
&& yum clean all \
&& rm -rf /var/cache/yum

ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
23 changes: 21 additions & 2 deletions bin/tag-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ def generate_tags(key, version):
print("Architectures: amd64, arm64v8")
print(f"Directory: {key}/jdk/al2\n")

# For LTS versions with modular AmazonLinux packages we want to tag those images
if key in ["17"]:
for image_type in ['al2-headless', 'al2-headful', 'al2-devel']:
print(f"Tags: {key}-{image_type}, {expanded_version}-{image_type}")
print("Architectures: amd64, arm64v8")
print(f"Directory: {key}/jdk/{image_type}\n")

if key in ["11"]:
for image_type in ['al2-headless', 'al2-devel']:
print(f"Tags: {key}-{image_type}, {expanded_version}-{image_type}")
print("Architectures: amd64, arm64v8")
print(f"Directory: {key}/jdk/{image_type}\n")

if key in ["8"]:
for image_type in ['al2-headful', 'al2-devel']:
print(f"Tags: {key}-{image_type}, {expanded_version}-{image_type}")
print("Architectures: amd64, arm64v8")
print(f"Directory: {key}/jdk/{image_type}\n")

for alpine_version in ALPINE_VERSIONS:
alpine_tags = [f"{key}-alpine{alpine_version}", f"{expanded_version}-alpine{alpine_version}", f"{key}-alpine{alpine_version}-full", f"{key}-alpine{alpine_version}-jdk"]
if alpine_version == DEFAULT_ALPINE_VERSION:
Expand All @@ -33,10 +52,10 @@ def generate_tags(key, version):
def main():
with open('versions.json','r') as version_file:
versions = json.load(version_file)

with open('.tags', 'w') as tag_file:
for key in versions:
generate_tags(key, versions[key])

if __name__ == "__main__":
main()
main()
12 changes: 12 additions & 0 deletions bin/update-dockerfiles.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash
set -xe
SED="sed -i"

sed --version 2>/dev/null || SED="sed -i.bkp"

usage() {
Expand Down Expand Up @@ -33,6 +35,16 @@ update_generic_linux() {
corretto_version=$(echo ${CORRETTO_VERSION} | cut -d'.' -f5)
${SED} "s/ARG version=.*/ARG version=${jdk_version}.${jdk_build}-${corretto_version}/g" ./${MAJOR_RELEASE}/jdk/al2/Dockerfile
${SED} "s/ARG version=.*/ARG version=${jdk_version}.${jdk_build}-${corretto_version}/g" ./${MAJOR_RELEASE}/jdk/debian/Dockerfile

ADDITIONAL_IMAGES="al2-devel al2-headful al2-headless"
for IMAGE_TYPE in ${ADDITIONAL_IMAGES}; do
echo "Checking $IMAGE_TYPE"
if [ -d ./${MAJOR_RELEASE}/jdk/${IMAGE_TYPE} ]; then
echo "Updating"

${SED} "s/ARG version=.*/ARG version=${jdk_version}.${jdk_build}-${corretto_version}/g" ./${MAJOR_RELEASE}/jdk/${IMAGE_TYPE}/Dockerfile
fi
done

${SED} "s/${MAJOR_RELEASE}\.0\.[0-9]*,/${jdk_version},/g" README.md
${SED} "s/${MAJOR_RELEASE}\.0\.[0-9]*-al2/${jdk_version}-al2/g" README.md
Expand Down
12 changes: 12 additions & 0 deletions test/test-image-corretto17-jre.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
schemaVersion: "2.0.0"

metadataTest:
env:
- key: LANG
value: C.UTF-8

commandTests:
- name: "java command is registered using alternatives."
command: "java"
args: ["-version"]
expectedError: ["OpenJDK Runtime Environment Corretto-17.*"]

0 comments on commit a98dfd3

Please sign in to comment.