Skip to content
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

Add Alpine glibc images #10779

Closed
wants to merge 2 commits into from
Closed

Conversation

karianna
Copy link
Contributor

Java 8 JDK and JRE, Java 11 JDK, Java 16 JDK

Java 8 JDK and JRE, Java 11 JDK, Java 16 JDK
@karianna
Copy link
Contributor Author

Apologies but this still needs a discussion/vote from the steering committee (will confirm tomorrow).

@tianon
Copy link
Member

tianon commented Aug 24, 2021

There's a fair amount of Alpine-related discussion in #5710 that should be taken into account as well.

@tianon tianon marked this pull request as draft August 24, 2021 17:43
@gdams
Copy link
Contributor

gdams commented Aug 25, 2021

There's a fair amount of Alpine-related discussion in #5710 that should be taken into account as well.

Are you mainly referring to the musl/glibc discussion? We plan on rolling out musl based builds in the near future and will swap the dockerfiles to consume from those binaries in due course. That said, it is unlikely that the musl patches will ever be backported to JDK8 and it could take some time for them to appear in the JDK11 codestream so my preference would be to begin with glibc based images.

@github-actions
Copy link

Diff for 9f7a8a9:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index bddc33c..54aee58 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,6 +1,11 @@
 Maintainers: George Adams <[email protected]> (@gdams)
 GitRepo: https://github.com/adoptium/containers.git
 
+Tags: 8u302-b08-jdk-alpine, 8-jdk-alpine, 8-alpine
+GitCommit: bfa8aa26f8ae68d79e0a83eac84718f28d8e594c
+Directory: 8/jdk/alpine
+File: Dockerfile.releases.full
+
 Tags: 8u302-b08-jdk-centos7, 8-jdk-centos7, 8-centos7
 Architectures: amd64, arm64v8, ppc64le
 GitCommit: 94ec04760777535e1ba0374f5ba051eabcf9b2ac
@@ -38,6 +43,11 @@ Directory: 8/jdk/windows/windowsservercore-ltsc2016
 File: Dockerfile.releases.full
 Constraints: windowsservercore-ltsc2016
 
+Tags: 8u302-b08-jre-alpine, 8-jre-alpine
+GitCommit: bfa8aa26f8ae68d79e0a83eac84718f28d8e594c
+Directory: 8/jre/alpine
+File: Dockerfile.releases.full
+
 Tags: 8u302-b08-jre-centos7, 8-jre-centos7
 GitCommit: 85457d397296c2b988998d8e98fe403df7cdcdc8
 Directory: 8/jre/centos
@@ -73,6 +83,11 @@ Directory: 8/jre/windows/windowsservercore-ltsc2016
 File: Dockerfile.releases.full
 Constraints: windowsservercore-ltsc2016
 
+Tags: 11.0.12_7-jdk-alpine, 11-jdk-alpine, 11-alpine
+GitCommit: bfa8aa26f8ae68d79e0a83eac84718f28d8e594c
+Directory: 11/jdk/alpine
+File: Dockerfile.releases.full
+
 Tags: 11.0.12_7-jdk-centos7, 11-jdk-centos7, 11-centos7
 Architectures: amd64, arm64v8, ppc64le
 GitCommit: 94ec04760777535e1ba0374f5ba051eabcf9b2ac
@@ -110,6 +125,11 @@ Directory: 11/jdk/windows/windowsservercore-ltsc2016
 File: Dockerfile.releases.full
 Constraints: windowsservercore-ltsc2016
 
+Tags: 16.0.2_7-jdk-alpine, 16-jdk-alpine, 16-alpine
+GitCommit: bfa8aa26f8ae68d79e0a83eac84718f28d8e594c
+Directory: 16/jdk/alpine
+File: Dockerfile.releases.full
+
 Tags: 16.0.2_7-jdk-centos7, 16-jdk-centos7, 16-centos7
 Architectures: amd64, arm64v8, ppc64le
 GitCommit: 94ec04760777535e1ba0374f5ba051eabcf9b2ac
diff --git a/_bashbrew-list b/_bashbrew-list
index 5b2f2ae..1d7e6af 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,5 +1,6 @@
 eclipse-temurin:8
 eclipse-temurin:8u302-b08-jdk
+eclipse-temurin:8u302-b08-jdk-alpine
 eclipse-temurin:8u302-b08-jdk-centos7
 eclipse-temurin:8u302-b08-jdk-focal
 eclipse-temurin:8u302-b08-jdk-nanoserver
@@ -8,6 +9,7 @@ eclipse-temurin:8u302-b08-jdk-windowsservercore
 eclipse-temurin:8u302-b08-jdk-windowsservercore-1809
 eclipse-temurin:8u302-b08-jdk-windowsservercore-ltsc2016
 eclipse-temurin:8u302-b08-jre
+eclipse-temurin:8u302-b08-jre-alpine
 eclipse-temurin:8u302-b08-jre-centos7
 eclipse-temurin:8u302-b08-jre-focal
 eclipse-temurin:8u302-b08-jre-nanoserver
@@ -15,9 +17,11 @@ eclipse-temurin:8u302-b08-jre-nanoserver-1809
 eclipse-temurin:8u302-b08-jre-windowsservercore
 eclipse-temurin:8u302-b08-jre-windowsservercore-1809
 eclipse-temurin:8u302-b08-jre-windowsservercore-ltsc2016
+eclipse-temurin:8-alpine
 eclipse-temurin:8-centos7
 eclipse-temurin:8-focal
 eclipse-temurin:8-jdk
+eclipse-temurin:8-jdk-alpine
 eclipse-temurin:8-jdk-centos7
 eclipse-temurin:8-jdk-focal
 eclipse-temurin:8-jdk-nanoserver
@@ -26,6 +30,7 @@ eclipse-temurin:8-jdk-windowsservercore
 eclipse-temurin:8-jdk-windowsservercore-1809
 eclipse-temurin:8-jdk-windowsservercore-ltsc2016
 eclipse-temurin:8-jre
+eclipse-temurin:8-jre-alpine
 eclipse-temurin:8-jre-centos7
 eclipse-temurin:8-jre-focal
 eclipse-temurin:8-jre-nanoserver
@@ -39,9 +44,11 @@ eclipse-temurin:8-windowsservercore
 eclipse-temurin:8-windowsservercore-1809
 eclipse-temurin:8-windowsservercore-ltsc2016
 eclipse-temurin:11
+eclipse-temurin:11-alpine
 eclipse-temurin:11-centos7
 eclipse-temurin:11-focal
 eclipse-temurin:11-jdk
+eclipse-temurin:11-jdk-alpine
 eclipse-temurin:11-jdk-centos7
 eclipse-temurin:11-jdk-focal
 eclipse-temurin:11-jdk-nanoserver
@@ -55,6 +62,7 @@ eclipse-temurin:11-windowsservercore
 eclipse-temurin:11-windowsservercore-1809
 eclipse-temurin:11-windowsservercore-ltsc2016
 eclipse-temurin:11.0.12_7-jdk
+eclipse-temurin:11.0.12_7-jdk-alpine
 eclipse-temurin:11.0.12_7-jdk-centos7
 eclipse-temurin:11.0.12_7-jdk-focal
 eclipse-temurin:11.0.12_7-jdk-nanoserver
@@ -63,9 +71,11 @@ eclipse-temurin:11.0.12_7-jdk-windowsservercore
 eclipse-temurin:11.0.12_7-jdk-windowsservercore-1809
 eclipse-temurin:11.0.12_7-jdk-windowsservercore-ltsc2016
 eclipse-temurin:16
+eclipse-temurin:16-alpine
 eclipse-temurin:16-centos7
 eclipse-temurin:16-focal
 eclipse-temurin:16-jdk
+eclipse-temurin:16-jdk-alpine
 eclipse-temurin:16-jdk-centos7
 eclipse-temurin:16-jdk-focal
 eclipse-temurin:16-jdk-nanoserver
@@ -79,6 +89,7 @@ eclipse-temurin:16-windowsservercore
 eclipse-temurin:16-windowsservercore-1809
 eclipse-temurin:16-windowsservercore-ltsc2016
 eclipse-temurin:16.0.2_7-jdk
+eclipse-temurin:16.0.2_7-jdk-alpine
 eclipse-temurin:16.0.2_7-jdk-centos7
 eclipse-temurin:16.0.2_7-jdk-focal
 eclipse-temurin:16.0.2_7-jdk-nanoserver
diff --git a/eclipse-temurin_11-focal/Dockerfile.releases.full b/eclipse-temurin_11-alpine/Dockerfile.releases.full
similarity index 40%
copy from eclipse-temurin_11-focal/Dockerfile.releases.full
copy to eclipse-temurin_11-alpine/Dockerfile.releases.full
index e3919ca..2baeac1 100644
--- a/eclipse-temurin_11-focal/Dockerfile.releases.full
+++ b/eclipse-temurin_11-alpine/Dockerfile.releases.full
@@ -17,33 +17,49 @@
 # limitations under the License.
 #
 
-FROM ubuntu:20.04
+FROM alpine:3.14
 
 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
 
-RUN apt-get update \
-    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata curl binutils ca-certificates fontconfig locales \
-    && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
-    && locale-gen en_US.UTF-8 \
-    && rm -rf /var/lib/apt/lists/*
+RUN apk add --no-cache tzdata --virtual .build-deps curl binutils zstd \
+    && GLIBC_VER="2.33-r0" \
+    && ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
+    && GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-10.1.0-2-x86_64.pkg.tar.zst" \
+    && GCC_LIBS_SHA256="f80320a03ff73e82271064e4f684cd58d7dbdb07aa06a2c4eea8e0f3c507c45c" \
+    && ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" \
+    && ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 \
+    && curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
+    && SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" \
+    && echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-${GLIBC_VER}.apk \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true \
+    && echo "export LANG=$LANG" > /etc/profile.d/locale.sh \
+    && curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.zst \
+    && echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.zst" | sha256sum -c - \
+    && mkdir /tmp/gcc \
+    && zstd -d /tmp/gcc-libs.tar.zst --output-dir-flat /tmp \
+    && tar -xf /tmp/gcc-libs.tar -C /tmp/gcc \
+    && mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
+    && strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
+    && curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz \
+    && echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - \
+    && mkdir /tmp/libz \
+    && tar -xf /tmp/libz.tar.xz -C /tmp/libz \
+    && mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib \
+    && apk del --purge .build-deps glibc-i18n \
+    && rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*
 
 ENV JAVA_VERSION jdk-11.0.12+7
 
 RUN set -eux; \
-    ARCH="$(dpkg --print-architecture)"; \
+    apk add --no-cache --virtual .fetch-deps curl; \
+    ARCH="$(apk --print-arch)"; \
     case "${ARCH}" in \
-       aarch64|arm64) \
-         ESUM='105bdc12fcd54c551e8e8ac96bc82412467244c32063689c41cee29ceb7452a2'; \
-         BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.12_7.tar.gz'; \
-         ;; \
-       ppc64el|ppc64le) \
-         ESUM='234a9bafe029ea6cab5d46f9617b5d016a29faa187a42081d0e066f23647b7e5'; \
-         BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.12_7.tar.gz'; \
-         ;; \
-       s390x) \
-         ESUM='99c1c61e9d67b01a649687189e5a00f89a2371dc1bfed06bb078d127edfa7995'; \
-         BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.12_7.tar.gz'; \
-         ;; \
        amd64|x86_64) \
          ESUM='8770f600fc3b89bf331213c7aa21f8eedd9ca5d96036d1cd48cb2748a3dbefd2'; \
          BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz'; \
@@ -58,6 +74,8 @@ RUN set -eux; \
     mkdir -p /opt/java/openjdk; \
     cd /opt/java/openjdk; \
     tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
+    apk del --purge .fetch-deps; \
+    rm -rf /var/cache/apk/*; \
     rm -rf /tmp/openjdk.tar.gz;
 
 ENV JAVA_HOME=/opt/java/openjdk \
diff --git a/eclipse-temurin_16-centos7/Dockerfile.releases.full b/eclipse-temurin_16-alpine/Dockerfile.releases.full
similarity index 40%
copy from eclipse-temurin_16-centos7/Dockerfile.releases.full
copy to eclipse-temurin_16-alpine/Dockerfile.releases.full
index db167af..e767589 100644
--- a/eclipse-temurin_16-centos7/Dockerfile.releases.full
+++ b/eclipse-temurin_16-alpine/Dockerfile.releases.full
@@ -17,26 +17,49 @@
 # limitations under the License.
 #
 
-FROM centos:7
+FROM alpine:3.14
 
 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
 
-RUN yum install -y tzdata openssl curl binutils ca-certificates fontconfig gzip tar \
-    && yum clean all
+RUN apk add --no-cache tzdata --virtual .build-deps curl binutils zstd \
+    && GLIBC_VER="2.33-r0" \
+    && ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
+    && GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-10.1.0-2-x86_64.pkg.tar.zst" \
+    && GCC_LIBS_SHA256="f80320a03ff73e82271064e4f684cd58d7dbdb07aa06a2c4eea8e0f3c507c45c" \
+    && ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" \
+    && ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 \
+    && curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
+    && SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" \
+    && echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-${GLIBC_VER}.apk \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true \
+    && echo "export LANG=$LANG" > /etc/profile.d/locale.sh \
+    && curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.zst \
+    && echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.zst" | sha256sum -c - \
+    && mkdir /tmp/gcc \
+    && zstd -d /tmp/gcc-libs.tar.zst --output-dir-flat /tmp \
+    && tar -xf /tmp/gcc-libs.tar -C /tmp/gcc \
+    && mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
+    && strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
+    && curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz \
+    && echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - \
+    && mkdir /tmp/libz \
+    && tar -xf /tmp/libz.tar.xz -C /tmp/libz \
+    && mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib \
+    && apk del --purge .build-deps glibc-i18n \
+    && rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*
 
 ENV JAVA_VERSION jdk-16.0.2+7
 
 RUN set -eux; \
-    ARCH="$(uname -m)"; \
+    apk add --no-cache --virtual .fetch-deps curl; \
+    ARCH="$(apk --print-arch)"; \
     case "${ARCH}" in \
-       aarch64|arm64) \
-         ESUM='cb77d9d126f97898dfdc8b5fb694d1e0e5d93d13a0a6cb2aeda76f8635384340'; \
-         BINARY_URL='https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_aarch64_linux_hotspot_16.0.2_7.tar.gz'; \
-         ;; \
-       ppc64el|ppc64le) \
-         ESUM='36ebe6c72f2fc19b8b17371f731390e15fa3aab08c28b55b9a8b71d0a578adc9'; \
-         BINARY_URL='https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_ppc64le_linux_hotspot_16.0.2_7.tar.gz'; \
-         ;; \
        amd64|x86_64) \
          ESUM='323d6d7474a359a28eff7ddd0df8e65bd61554a8ed12ef42fd9365349e573c2c'; \
          BINARY_URL='https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz'; \
@@ -51,6 +74,8 @@ RUN set -eux; \
     mkdir -p /opt/java/openjdk; \
     cd /opt/java/openjdk; \
     tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
+    apk del --purge .fetch-deps; \
+    rm -rf /var/cache/apk/*; \
     rm -rf /tmp/openjdk.tar.gz;
 
 ENV JAVA_HOME=/opt/java/openjdk \
diff --git a/eclipse-temurin_8-centos7/Dockerfile.releases.full b/eclipse-temurin_8-alpine/Dockerfile.releases.full
similarity index 39%
copy from eclipse-temurin_8-centos7/Dockerfile.releases.full
copy to eclipse-temurin_8-alpine/Dockerfile.releases.full
index 35ad86c..0cf3bbf 100644
--- a/eclipse-temurin_8-centos7/Dockerfile.releases.full
+++ b/eclipse-temurin_8-alpine/Dockerfile.releases.full
@@ -17,26 +17,49 @@
 # limitations under the License.
 #
 
-FROM centos:7
+FROM alpine:3.14
 
 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
 
-RUN yum install -y tzdata openssl curl binutils ca-certificates fontconfig gzip tar \
-    && yum clean all
+RUN apk add --no-cache tzdata --virtual .build-deps curl binutils zstd \
+    && GLIBC_VER="2.33-r0" \
+    && ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
+    && GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-10.1.0-2-x86_64.pkg.tar.zst" \
+    && GCC_LIBS_SHA256="f80320a03ff73e82271064e4f684cd58d7dbdb07aa06a2c4eea8e0f3c507c45c" \
+    && ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" \
+    && ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 \
+    && curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
+    && SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" \
+    && echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-${GLIBC_VER}.apk \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true \
+    && echo "export LANG=$LANG" > /etc/profile.d/locale.sh \
+    && curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.zst \
+    && echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.zst" | sha256sum -c - \
+    && mkdir /tmp/gcc \
+    && zstd -d /tmp/gcc-libs.tar.zst --output-dir-flat /tmp \
+    && tar -xf /tmp/gcc-libs.tar -C /tmp/gcc \
+    && mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
+    && strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
+    && curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz \
+    && echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - \
+    && mkdir /tmp/libz \
+    && tar -xf /tmp/libz.tar.xz -C /tmp/libz \
+    && mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib \
+    && apk del --purge .build-deps glibc-i18n \
+    && rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*
 
 ENV JAVA_VERSION jdk8u302-b08
 
 RUN set -eux; \
-    ARCH="$(uname -m)"; \
+    apk add --no-cache --virtual .fetch-deps curl; \
+    ARCH="$(apk --print-arch)"; \
     case "${ARCH}" in \
-       aarch64|arm64) \
-         ESUM='f287cdc2a688c2df247ea0d8bfe2863645b73848e4e5c35b02a8a3d2d6b69551'; \
-         BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_aarch64_linux_hotspot_8u302b08.tar.gz'; \
-         ;; \
-       ppc64el|ppc64le) \
-         ESUM='c2940f3772d4467a818a0221e80c2c720b6d427a886aaed37262e451ddbb0a56'; \
-         BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_ppc64le_linux_hotspot_8u302b08.tar.gz'; \
-         ;; \
        amd64|x86_64) \
          ESUM='cc13f274becf9dd5517b6be583632819dfd4dd81e524b5c1b4f406bdaf0e063a'; \
          BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz'; \
@@ -51,6 +74,8 @@ RUN set -eux; \
     mkdir -p /opt/java/openjdk; \
     cd /opt/java/openjdk; \
     tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
+    apk del --purge .fetch-deps; \
+    rm -rf /var/cache/apk/*; \
     rm -rf /tmp/openjdk.tar.gz;
 
 ENV JAVA_HOME=/opt/java/openjdk \
diff --git a/eclipse-temurin_8-jre-focal/Dockerfile.releases.full b/eclipse-temurin_8-jre-alpine/Dockerfile.releases.full
similarity index 40%
copy from eclipse-temurin_8-jre-focal/Dockerfile.releases.full
copy to eclipse-temurin_8-jre-alpine/Dockerfile.releases.full
index 5aa98c5..6ff3af9 100644
--- a/eclipse-temurin_8-jre-focal/Dockerfile.releases.full
+++ b/eclipse-temurin_8-jre-alpine/Dockerfile.releases.full
@@ -17,20 +17,48 @@
 # limitations under the License.
 #
 
-FROM ubuntu:20.04
+FROM alpine:3.14
 
 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
 
-RUN apt-get update \
-    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata curl ca-certificates fontconfig locales \
-    && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
-    && locale-gen en_US.UTF-8 \
-    && rm -rf /var/lib/apt/lists/*
+RUN apk add --no-cache tzdata --virtual .build-deps curl binutils zstd \
+    && GLIBC_VER="2.33-r0" \
+    && ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
+    && GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-10.1.0-2-x86_64.pkg.tar.zst" \
+    && GCC_LIBS_SHA256="f80320a03ff73e82271064e4f684cd58d7dbdb07aa06a2c4eea8e0f3c507c45c" \
+    && ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" \
+    && ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 \
+    && curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
+    && SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" \
+    && echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-${GLIBC_VER}.apk \
+    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk \
+    && curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk \
+    && /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true \
+    && echo "export LANG=$LANG" > /etc/profile.d/locale.sh \
+    && curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.zst \
+    && echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.zst" | sha256sum -c - \
+    && mkdir /tmp/gcc \
+    && zstd -d /tmp/gcc-libs.tar.zst --output-dir-flat /tmp \
+    && tar -xf /tmp/gcc-libs.tar -C /tmp/gcc \
+    && mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
+    && strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
+    && curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz \
+    && echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - \
+    && mkdir /tmp/libz \
+    && tar -xf /tmp/libz.tar.xz -C /tmp/libz \
+    && mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib \
+    && apk del --purge .build-deps glibc-i18n \
+    && rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*
 
 ENV JAVA_VERSION jdk8u302-b08
 
 RUN set -eux; \
-    ARCH="$(dpkg --print-architecture)"; \
+    apk add --no-cache --virtual .fetch-deps curl; \
+    ARCH="$(apk --print-arch)"; \
     case "${ARCH}" in \
        amd64|x86_64) \
          ESUM='a74e63657ad04151a8f95202071d2895f1cc9295c910ad3c361ff1cc27395107'; \
@@ -46,6 +74,8 @@ RUN set -eux; \
     mkdir -p /opt/java/openjdk; \
     cd /opt/java/openjdk; \
     tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
+    apk del --purge .fetch-deps; \
+    rm -rf /var/cache/apk/*; \
     rm -rf /tmp/openjdk.tar.gz;
 
 ENV JAVA_HOME=/opt/java/openjdk \

@karianna
Copy link
Contributor Author

The Project Management Committee (PMC) is putting this on pause until we get more feedback from our community. I'll update or withdraw this PR in a week's time or so.

@tianon
Copy link
Member

tianon commented Aug 25, 2021

Yes, I was referring to the glibc vs musl discussion -- IMO, there's really not much that's very compelling about a glibc-including Alpine image, but there's a lot of great discussion on that happening in adoptium/containers#1.

@kaniini
Copy link

kaniini commented Aug 26, 2021

It should be noted that Alpine itself does not support alpine-glibc. It is not a blessed project by us, we actively discourage its use. Users of alpine-glibc are effectively on their own, we cannot guarantee the stability, reliability or security of that configuration.

In fact, we would appreciate it if the people combining Alpine and glibc would stop referring to their product as being some sort of Alpine thing. It is not — it is done entirely by a third party and we cannot and do not provide any support whatsoever for it.

@kaniini
Copy link

kaniini commented Aug 26, 2021

As it has become obvious that Alpine needs to more forcefully signal its opposition to alpine-pkg-glibc, there is now a proposed change which blocks the coexistence of musl and glibc packages by default.

If that change is accepted (I see no reason why it won't be as we're quite tired of this topic), users who wish to combine both libcs for whatever reason, will need to build their own copy of musl with ALLOW_GLIBC_PKG=1 in abuild.conf.

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/24647

@kaniini
Copy link

kaniini commented Aug 26, 2021

A longer post on my blog explaining why alpine-glibc is bad and should never be used in production: https://ariadne.space/2021/08/26/there-is-no-such-thing-as-a-glibc-based-alpine-image/

@ncopa
Copy link
Contributor

ncopa commented Aug 26, 2021

As maintainer of the alpine docker image (and as founder of Alpine itself) I would advise against providing alpine with glibc. As @kaniini explained in the blog post, it might work or it may blow up in your face. And there is no guarantee that it will not blow up in your face tomorrow.

I can give you a specific example why this is a bad idea:

ncopa-desktop:~$ docker run --rm -t eclipse-temurin ldd /opt/java/openjdk/bin/javac
	linux-vdso.so.1 (0x00007ffc6f6bc000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3c510dd000)
	libjli.so => /opt/java/openjdk/bin/../lib/libjli.so (0x00007f3c50ecc000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3c50ea9000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3c50ea3000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3c50cb1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3c51301000)

Running javac linked to glibc on alpine docker image might have worked if glibc was the only runtime dependency that javac used. But as you see there is another library, libz.so.1, there as well, and unless some specific steps are taken to make sure that the libz.so.1 used is also linked to glibc, you will end up using the alpine libz.so.1 which is linked to musl libc. This may result in alpine libz unexpectedly ending up using symbols from glibc, javac using symbols from musl or maybe even glibc using symbols from musl or vice versa.

This might have worked if JDK linked to a static libz.a, but at that point they could also linked the libc statically and there would have not been any problem to run it on alpine. But they didn't and trying to run this on alpine is a high risk of shooting your self in the foot.

If you still decide to go this route, please remove the alpine name from everything, so any issues users might have does not end up in Alpine's bug tracker by mistake.

@karianna
Copy link
Contributor Author

karianna commented Aug 26, 2021 via email

@MrStonedOne

This comment has been minimized.

@tianon
Copy link
Member

tianon commented Aug 26, 2021

Given the Temurin project has access to the TCK (at least, that's my understanding?), perhaps some of those tests could be run against the existing builds with the official gcompat package installed to see if what Alpine already provides is sufficient?

@kaniini
Copy link

kaniini commented Aug 26, 2021

I doubt gcompat is complete enough to pass the TCK, for what it's worth. However, Azul Zulu builds natively with musl, passes the TCK and even has a nice repo for Alpine users.

@ncopa
Copy link
Contributor

ncopa commented Aug 26, 2021

However, Azul Zulu builds natively with musl, passes the TCK and even has a nice repo for Alpine users.

Same seems to be the case for AWS corretto.

@karianna
Copy link
Contributor Author

karianna commented Sep 1, 2021

Hi all,

TLDR Decision

The PMC met today and decided not to go ahead with the glibc based Alpine images.

Reasoning

The Alpine Committers and Maintainers have made it clear why glibc based Apline Images are a really bad idea (see comments above and/or at the Adoptium Pull Request.

The Adoptium PMC believes that as part of distributing a secure and stable supply chain we should adhere to the guidelines from the Alpine maintainers.

Next Steps

We will therefore discard this Pull Request from Docker official and remove the subsequent glibc alpine support from the adoptium containers repository.

A blog post explaining this decision and recommending alternatives (e.g. Smaller ubuntu/centos/ubi style images) will be made.

The Future --> Musl Builds

What we will do is push forward with our musl based alpine image investigations.

  • Java 16/17 - Those builds are doable today but we need to set up TCK infrastructure for those and see if we can make sure that meets compliance.
  • Java 8/11 - the various VM Engineers involved in the supporting companies (Azul, Microsoft, Red Hat, IBM, et al) will look to backporting the musl patches to Java 8 and 11. Timeline TBD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants