From 1b3c8bf026a0b1bd8bc0e1f993f8b43749f03b06 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Wed, 14 Jul 2021 21:24:52 +0700 Subject: [PATCH] Task: Add OpenJDK 11 with GitHub Workflows Build and Publish DockerHub --- .github/workflows/docker.yml | 27 ++++++++++ .gitignore | 0 11/Dockerfile | 99 ++++++++++++++++++++++++++++++++++++ 11/LICENSE | 20 ++++++++ 11/README.md | 25 +++++++++ 11/build.sh | 12 +++++ 11/version.txt | 5 ++ 8/LICENSE | 20 ++++++++ 8/version.txt | 5 ++ LICENSE | 20 ++++++++ Makefile | 5 ++ README.md | 8 +++ version.txt | 5 ++ 13 files changed, 251 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 .gitignore create mode 100644 11/Dockerfile create mode 100644 11/LICENSE create mode 100644 11/README.md create mode 100644 11/build.sh create mode 100644 11/version.txt create mode 100644 8/LICENSE create mode 100644 8/version.txt create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 version.txt diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..a0bf2d7 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,27 @@ +name: CI +on: + push: + branches: + - 'main' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_SECRET }} + - + name: Checkout + uses: actions/checkout@v2 + + - + name: Build and Push from Makefile + run: | + make build \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/11/Dockerfile b/11/Dockerfile new file mode 100644 index 0000000..9f91b32 --- /dev/null +++ b/11/Dockerfile @@ -0,0 +1,99 @@ +FROM cubetiq/calpine-os-linux:latest +LABEL maintainer="sombochea@cubetiqs.com" + +# Run as root +USER root + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' +ENV TIMEZ=Asia/Phnom_Penh +RUN echo "Start building the openjdk..." +RUN mkdir -p /src/cubetiq/build +COPY LICENSE version.txt /src/cubetiq/build/ +RUN echo "Starting setting up timezone to ${TIMEZ}..." + +# For Alpine +# Setup Timezone +RUN apk update && \ + apk add --no-cache tzdata && \ + cp /usr/share/zoneinfo/${TIMEZ} /etc/localtime && \ + echo ${TIMEZ} > /etc/timezone + +RUN apk add --no-cache --virtual .build-deps curl binutils zstd \ + && GLIBC_VER="2.31-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/* + +# Remove unused anymore +RUN apk del tzdata +ENV RELEASE_DATE 2020-12-07-10-34 +ENV JAVA_BUILD jdk11u-${RELEASE_DATE} +ENV JAVA_BUILD_TYPE jdk + +RUN set -eux; \ + apk add --no-cache --virtual .fetch-deps curl; \ + ARCH="$(apk --print-arch)"; \ + case "${ARCH}" in \ + aarch64|arm64) \ + BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/${JAVA_BUILD}/OpenJDK11U-${JAVA_BUILD_TYPE}_aarch64_linux_hotspot_${RELEASE_DATE}.tar.gz'; \ + ;; \ + armhf|armv7l) \ + BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/${JAVA_BUILD}/OpenJDK11U-${JAVA_BUILD_TYPE}_arm_linux_hotspot_${RELEASE_DATE}.tar.gz'; \ + ;; \ + ppc64el|ppc64le) \ + BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/${JAVA_BUILD}/OpenJDK11U-${JAVA_BUILD_TYPE}_ppc64le_linux_hotspot_${RELEASE_DATE}.tar.gz'; \ + ;; \ + s390x) \ + BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/${JAVA_BUILD}/OpenJDK11U-${JAVA_BUILD_TYPE}_s390x_linux_hotspot_${RELEASE_DATE}.tar.gz'; \ + ;; \ + amd64|x86_64) \ + BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/${JAVA_BUILD}/OpenJDK11U-${JAVA_BUILD_TYPE}_x64_linux_hotspot_${RELEASE_DATE}.tar.gz'; \ + ;; \ + *) \ + echo "Unsupported arch: ${ARCH}"; \ + exit 1; \ + ;; \ + esac; \ + curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \ + curl -LfsSo /tmp/openjdk.tar.gz.sha256.txt ${BINARY_URL}.sha256.txt; \ + ESUM=`cat /tmp/openjdk.tar.gz.sha256.txt`; \ + echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \ + 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; + +RUN echo "All has been completed, enjoy!" +ENV JAVA_HOME=/opt/java/openjdk \ + PATH="/opt/java/openjdk/bin:$PATH" + +CMD [ "java", "-version" ] \ No newline at end of file diff --git a/11/LICENSE b/11/LICENSE new file mode 100644 index 0000000..473df7a --- /dev/null +++ b/11/LICENSE @@ -0,0 +1,20 @@ +MIT License + +Copyright (c) 2018-2020 Dave Hall + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECT \ No newline at end of file diff --git a/11/README.md b/11/README.md new file mode 100644 index 0000000..0cb1032 --- /dev/null +++ b/11/README.md @@ -0,0 +1,25 @@ +# CUBETIQ Alpine OS Linux OpenJDK 11 +![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/cubetiq/calpine-openjdk:11) +![Docker Pulls](https://img.shields.io/docker/pulls/cubetiq/calpine-openjdk:11) + +- OpenJDK 11 +- Timezone default Phnom Penh + +# Build +```shell +make build +``` + +# [Docker Hub](https://hub.docker.com/r/cubetiq/calpine-openjdk:11) +### Pull image +```shell +docker pull cubetiq/calpine-openjdk:11 +``` + +### Running container +```shell +docker run --rm -it cubetiq/calpine-openjdk:11 /bin/sh +``` + +# Contributors +- Sambo Chea \ No newline at end of file diff --git a/11/build.sh b/11/build.sh new file mode 100644 index 0000000..b4c7c3a --- /dev/null +++ b/11/build.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +C_ORG=cubetiq +C_IMG=calpine-openjdk +C_TAG=11 +C_ROOT=${C_ORG}/${C_IMG}:${C_TAG} + +echo "Starting build for OpenJDK: ${C_ROOT}" +docker build . -t ${C_ROOT} + +echo "Publishing to DockerHub with ${C_ROOT}" +docker push ${C_ROOT} \ No newline at end of file diff --git a/11/version.txt b/11/version.txt new file mode 100644 index 0000000..c86d6e3 --- /dev/null +++ b/11/version.txt @@ -0,0 +1,5 @@ +os: calpine-os-linux 3.13.3 +openjdk: 11 +author: sombochea +company: cubetiq solution +build: 14/07/2021 \ No newline at end of file diff --git a/8/LICENSE b/8/LICENSE new file mode 100644 index 0000000..473df7a --- /dev/null +++ b/8/LICENSE @@ -0,0 +1,20 @@ +MIT License + +Copyright (c) 2018-2020 Dave Hall + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECT \ No newline at end of file diff --git a/8/version.txt b/8/version.txt new file mode 100644 index 0000000..d8c448f --- /dev/null +++ b/8/version.txt @@ -0,0 +1,5 @@ +os: calpine-os-linux 3.13.3 +openjdk: 8 +author: sombochea +company: cubetiq solution +build: 14/07/2021 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..473df7a --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +MIT License + +Copyright (c) 2018-2020 Dave Hall + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECT \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..08c3311 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +build: + @echo 'Starting docker build' + ./11/build.sh + +.PHONY:build diff --git a/README.md b/README.md new file mode 100644 index 0000000..875e61f --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# CUBETIQ Alpine OpenJDK +- Support OpenJDK + +# OpenJDK Versions +- OpenJDK-11 + +# Contributors +- Sambo Chea \ No newline at end of file diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..6d7ca5d --- /dev/null +++ b/version.txt @@ -0,0 +1,5 @@ +os: calpine-os-linux 3.13.3 +openjdk: default +author: sombochea +company: cubetiq solution +build: 14/07/2021 \ No newline at end of file