From 0fc3951fc1677ebeb676771239f2965c09b00b55 Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Fri, 17 Sep 2021 10:00:30 +0800 Subject: [PATCH] Add jdk11 support (#38) * Add jdk11 support Signed-off-by: rick <1450685+LinuxSuRen@users.noreply.github.com> * Build maven-jdk11 image via github action --- .github/workflows/build.yaml | 69 +++++++++++++++++++++++++++++++++++- Makefile | 2 ++ maven/Dockerfile | 4 ++- maven/Dockerfile.podman | 43 ---------------------- 4 files changed, 73 insertions(+), 45 deletions(-) delete mode 100644 maven/Dockerfile.podman diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 070256b..a7907b0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -301,6 +301,74 @@ jobs: labels: ${{ steps.metaContributors.outputs.labels }} platforms: linux/amd64,linux/arm64 + BuildMavenJDK11: + needs: BuildBase + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Docker meta for KubeSphere + id: meta + if: github.repository_owner == 'kubesphere' + uses: docker/metadata-action@v3 + with: + images: | + kubespheredev/builder-maven + ghcr.io/${{ github.repository_owner }}/builder-maven + tags: | + type=ref,event=branch,suffix=jdk11 + type=ref,event=pr,suffix=jdk11 + type=semver,pattern=v{{version}},suffix=jdk11 + - name: Docker meta for Contributors + id: metaContributors + if: github.repository_owner != 'kubesphere' + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository_owner }}/builder-maven + tags: | + type=ref,event=branch,suffix=jdk11 + type=ref,event=pr,suffix=jdk11 + type=semver,pattern=v{{version}},suffix=jdk11 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_SECRETS }} + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + - name: Build and push Docker images + uses: docker/build-push-action@v2.4.0 + if: github.repository_owner == 'kubesphere' + with: + context: maven + file: maven/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + build-args: "JDK_VERSION=11" + - name: Build and push Docker images for Contributors + uses: docker/build-push-action@v2.4.0 + if: github.repository_owner != 'kubesphere' + with: + context: maven + file: maven/Dockerfile + tags: ${{ steps.metaContributors.outputs.tags }} + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.metaContributors.outputs.labels }} + platforms: linux/amd64,linux/arm64 + build-args: "JDK_VERSION=11" + BuildNodeJs: needs: BuildBase runs-on: ubuntu-latest @@ -376,7 +444,6 @@ jobs: platforms: linux/amd64,linux/arm64 BuildDotnet: - needs: BuildDotnet runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 733816f..f9ecafb 100644 --- a/Makefile +++ b/Makefile @@ -11,3 +11,5 @@ build-maven-podman: push-maven-podman: docker push kubespheredev/builder-maven:$(VERSION)-podman +build-jdk11: + docker build maven -f maven/Dockerfile -t kubespheredev/builder-maven:$(VERSION)-jdk11 --build-arg JDK_VERSION=11 diff --git a/maven/Dockerfile b/maven/Dockerfile index 0e32968..76bb5d8 100644 --- a/maven/Dockerfile +++ b/maven/Dockerfile @@ -1,7 +1,9 @@ FROM kubespheredev/builder-base:v3.1.0 +ARG JDK_VERSION 1.8.0 + # java -ENV JAVA_VERSIOIN 1.8.0 +ENV JAVA_VERSIOIN $JDK_VERSION RUN yum install -y java-${JAVA_VERSIOIN}-openjdk-devel \ java-${JAVA_VERSIOIN}-openjdk-devel.i686 diff --git a/maven/Dockerfile.podman b/maven/Dockerfile.podman deleted file mode 100644 index 9980d65..0000000 --- a/maven/Dockerfile.podman +++ /dev/null @@ -1,43 +0,0 @@ -FROM kubespheredev/builder-base:v3.1.0 - -# java -ENV JAVA_VERSIOIN 1.8.0 -RUN yum install -y java-${JAVA_VERSIOIN}-openjdk-devel \ - java-${JAVA_VERSIOIN}-openjdk-devel.i686 - -# maven -ENV MAVEN_VERSION 3.5.3 -RUN curl -f -L https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -C /opt -xzv -ENV M2_HOME /opt/apache-maven-$MAVEN_VERSION -ENV JAVA_HOME /usr/lib/jvm/java-${JAVA_VERSIOIN}-openjdk -ENV maven.home $M2_HOME -ENV M2 $M2_HOME/bin -ENV PATH $M2:$PATH:JAVA_HOME/bin - -# ant -ENV ANT_VERSION 1.10.7 -RUN cd && \ - wget -q https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ - tar -xzf apache-ant-${ANT_VERSION}-bin.tar.gz && \ - mv apache-ant-${ANT_VERSION} /opt/ant && \ - rm apache-ant-${ANT_VERSION}-bin.tar.gz -ENV ANT_HOME /opt/ant -ENV PATH ${PATH}:/opt/ant/bin - -# Set JDK to be 32bit -COPY set_java $M2 -RUN $M2/set_java && rm $M2/set_java - -# Install podman -RUN curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo && \ - yum -y install podman fuse-overlayfs --exclude container-selinux && \ - sed -i 's/#mount_program/mount_program/g' /etc/containers/storage.conf - -RUN useradd podman; \ - echo podman:10000:5000 > /etc/subuid; \ - echo podman:10000:5000 > /etc/subgid; - -RUN chmod 644 /etc/containers/containers.conf && \ - sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf - -CMD ["mvn","-version"]