From 2eef7ef7439b92319e973d076bef271a43104d42 Mon Sep 17 00:00:00 2001 From: Minionguyjpro Date: Thu, 19 Sep 2024 19:54:24 +0200 Subject: [PATCH] Add Microsoft Build for OpenJDK Docker Image Signed-off-by: Minionguyjpro --- .github/workflows/java-microsoft-openjdk.yml | 65 ++++++++++++++++++++ java-microsoft-openjdk/11/Dockerfile | 25 ++++++++ java-microsoft-openjdk/17/Dockerfile | 25 ++++++++ java-microsoft-openjdk/21/Dockerfile | 25 ++++++++ java-microsoft-openjdk/8/Dockerfile | 23 +++++++ java-microsoft-openjdk/entrypoint.sh | 22 +++++++ 6 files changed, 185 insertions(+) create mode 100644 .github/workflows/java-microsoft-openjdk.yml create mode 100644 java-microsoft-openjdk/11/Dockerfile create mode 100644 java-microsoft-openjdk/17/Dockerfile create mode 100644 java-microsoft-openjdk/21/Dockerfile create mode 100644 java-microsoft-openjdk/8/Dockerfile create mode 100644 java-microsoft-openjdk/entrypoint.sh diff --git a/.github/workflows/java-microsoft-openjdk.yml b/.github/workflows/java-microsoft-openjdk.yml new file mode 100644 index 0000000..e0e4fe9 --- /dev/null +++ b/.github/workflows/java-microsoft-openjdk.yml @@ -0,0 +1,65 @@ +name: build java_microsoft_openjdk + +on: + workflow_dispatch: + schedule: + - cron: "0 17 1,15 * *" # bi-weekly on 1st and 15th calendar day at 17:00 + push: + branches: + - main + paths: + - java-microsoft-openjdk/** + +permissions: + actions: read + packages: write + +concurrency: + group: java-microsoft-openjdk-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + build_and_push: + name: "java_${{ matrix.tag }}_microsoft_openjdk" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + tag: + - 8 + - 11 + - 17 + - 21 + steps: + - name: Git checkout for Github repository workspace + uses: actions/checkout@v4 + + - name: Setup QEMU for multiarch builds + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: --debug + + - name: Login to registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up repository in lowercase + run: | + repo="${{ github.repository }}" + repo_lower=$(echo "$repo" | tr '[:upper:]' '[:lower:]') + echo "repo_lower=$repo_lower" >> $GITHUB_ENV + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: ./java-microsoft-openjdk + platforms: linux/amd64,linux/arm64 + file: ./java-microsoft-openjdk/${{ matrix.tag }}/Dockerfile + push: true + tags: ghcr.io/${{ env.repo_lower }}:java_${{ matrix.tag }}_microsoft_openjdk diff --git a/java-microsoft-openjdk/11/Dockerfile b/java-microsoft-openjdk/11/Dockerfile new file mode 100644 index 0000000..ce51c41 --- /dev/null +++ b/java-microsoft-openjdk/11/Dockerfile @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/openjdk/jdk:11-ubuntu + +LABEL author="Software-noob" maintainer="admin@softwarenoob.com" +LABEL org.opencontainers.image.source="https://github.com/Software-Noob/pterodactyl-images" +LABEL org.opencontainers.image.licenses="MIT" + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update \ + && apt-get -y install --no-install-recommends curl ffmpeg iproute2 git sqlite3 python3 tzdata ca-certificates dnsutils fontconfig libfreetype6 libstdc++6 lsof build-essential locales \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && useradd -m -d /home/container container \ + && locale-gen en_US.UTF-8 + +ENV LC_ALL=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 + +USER container +ENV USER=container HOME=/home/container +WORKDIR /home/container + +COPY ./entrypoint.sh /entrypoint.sh +CMD [ "/bin/bash", "/entrypoint.sh" ] \ No newline at end of file diff --git a/java-microsoft-openjdk/17/Dockerfile b/java-microsoft-openjdk/17/Dockerfile new file mode 100644 index 0000000..b0eaa38 --- /dev/null +++ b/java-microsoft-openjdk/17/Dockerfile @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/openjdk/jdk:17-ubuntu + +LABEL author="Software-noob" maintainer="admin@softwarenoob.com" +LABEL org.opencontainers.image.source="https://github.com/Software-Noob/pterodactyl-images" +LABEL org.opencontainers.image.licenses="MIT" + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update \ + && apt-get -y install --no-install-recommends curl ffmpeg iproute2 git sqlite3 python3 tzdata ca-certificates dnsutils fontconfig libfreetype6 libstdc++6 lsof build-essential locales \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && useradd -m -d /home/container container \ + && locale-gen en_US.UTF-8 + +ENV LC_ALL=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 + +USER container +ENV USER=container HOME=/home/container +WORKDIR /home/container + +COPY ./entrypoint.sh /entrypoint.sh +CMD [ "/bin/bash", "/entrypoint.sh" ] \ No newline at end of file diff --git a/java-microsoft-openjdk/21/Dockerfile b/java-microsoft-openjdk/21/Dockerfile new file mode 100644 index 0000000..87cbc5b --- /dev/null +++ b/java-microsoft-openjdk/21/Dockerfile @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu + +LABEL author="Software-noob" maintainer="admin@softwarenoob.com" +LABEL org.opencontainers.image.source="https://github.com/Software-Noob/pterodactyl-images" +LABEL org.opencontainers.image.licenses="MIT" + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update \ + && apt-get -y install --no-install-recommends curl ffmpeg iproute2 git sqlite3 python3 tzdata ca-certificates dnsutils fontconfig libfreetype6 libstdc++6 lsof build-essential locales \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && useradd -m -d /home/container container \ + && locale-gen en_US.UTF-8 + +ENV LC_ALL=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 + +USER container +ENV USER=container HOME=/home/container +WORKDIR /home/container + +COPY ./entrypoint.sh /entrypoint.sh +CMD [ "/bin/bash", "/entrypoint.sh" ] \ No newline at end of file diff --git a/java-microsoft-openjdk/8/Dockerfile b/java-microsoft-openjdk/8/Dockerfile new file mode 100644 index 0000000..b458d21 --- /dev/null +++ b/java-microsoft-openjdk/8/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/openjdk/jdk:8-mariner + +LABEL author="Softwarenoob" maintainer="admin@softwarenoob.com" +LABEL org.opencontainers.image.source="https://github.com/Software-Noob/pterodactyl-images" +LABEL org.opencontainers.image.licenses="MIT" + +RUN yum upgrade -y \ + && yum install -y curl ca-certificates openssl git tar sqlite fontconfig freetype libstdc++.so.6 freetype-devel lsof build-essential tzdata iproute \ + git gcc gcc-c++ automake make libtool \ + && yum clean all \ + && rm -rf /var/cache/yum \ + && useradd -m -d /home/container container + +ENV LC_ALL=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 + +USER container +ENV USER=container HOME=/home/container +WORKDIR /home/container + +COPY ./entrypoint.sh /entrypoint.sh +CMD [ "/bin/bash", "/entrypoint.sh" ] diff --git a/java-microsoft-openjdk/entrypoint.sh b/java-microsoft-openjdk/entrypoint.sh new file mode 100644 index 0000000..b8d8a2b --- /dev/null +++ b/java-microsoft-openjdk/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/bash +cd /home/container || exit 1 + +# Configure colors +YELLOW='\033[0;33m' +RESET_COLOR='\033[0m' + +# Print Current Java Version +java -version + +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP + +# Replace Startup Variables +# shellcheck disable=SC2086 +MODIFIED_STARTUP=$(eval echo "$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')") +echo -e "${YELLOW}[Startup Command]: ${MODIFIED_STARTUP} ${RESET_COLOR}" + +# Run the Server +# shellcheck disable=SC2086 +exec ${MODIFIED_STARTUP} \ No newline at end of file