From d09cb9767db8e63067cdeed3df0e0529454ada03 Mon Sep 17 00:00:00 2001 From: Sergii Kabashniuk Date: Tue, 22 Feb 2022 08:48:10 +0200 Subject: [PATCH] build: Use ubi as default based image for che-server build (#262) * Use ubi as default based image for che-server build * Set strict java 11 version Co-authored-by: Michal Vala --- .github/workflows/build-pr-check.yml | 12 +++------ .github/workflows/next-build.yml | 20 +++------------ .github/workflows/release.yml | 5 ++-- .github/workflows/sonar.yaml | 11 +++------ dockerfiles/che/Dockerfile | 35 ++++++++++++++++++++------ dockerfiles/che/rhel.Dockerfile | 37 ---------------------------- 6 files changed, 39 insertions(+), 81 deletions(-) delete mode 100644 dockerfiles/che/rhel.Dockerfile diff --git a/.github/workflows/build-pr-check.yml b/.github/workflows/build-pr-check.yml index 8c30c78520..8952116b67 100644 --- a/.github/workflows/build-pr-check.yml +++ b/.github/workflows/build-pr-check.yml @@ -20,17 +20,11 @@ jobs: fetch-depth: 0 - name: Check all properties have description run: ./check_properties_description.sh - - name: Cache local Maven repository - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: Set up JDK 11 uses: actions/setup-java@v2 with: - distribution: 'adopt' - java-version: '11.0.11+9' + distribution: 'temurin' + java-version: '11.0.14' + cache: 'maven' - name: Build with Maven run: mvn -B clean install -U -Pintegration diff --git a/.github/workflows/next-build.yml b/.github/workflows/next-build.yml index 13412ec44f..d4b8155627 100644 --- a/.github/workflows/next-build.yml +++ b/.github/workflows/next-build.yml @@ -22,18 +22,12 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Cache local Maven repository - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: Set up JDK 11 uses: actions/setup-java@v2 with: - distribution: 'adopt' - java-version: '11.0.11+9' + distribution: 'temurin' + java-version: '11.0.14' + cache: 'maven' - name: Login to docker.io uses: docker/login-action@v1 with: @@ -67,14 +61,6 @@ jobs: docker push quay.io/eclipse/che-server:next docker push quay.io/eclipse/che-server:${{ steps.build.outputs.short_sha1 }} - - name: Build ubi8 Che Server image - run: | - ./dockerfiles/che/build.sh --dockerfile:"rhel.Dockerfile" --tag:"rhel-next" - docker tag quay.io/eclipse/che-server:rhel-next quay.io/eclipse/che-server:rhel-${{ steps.build.outputs.short_sha1 }} - - name: Push ubi8 Che Server image - run: | - docker push quay.io/eclipse/che-server:rhel-next - docker push quay.io/eclipse/che-server:rhel-${{ steps.build.outputs.short_sha1 }} - name: Create failure MM message if: ${{ failure() }} run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1383f6aa5..404746bf98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -81,8 +81,9 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v2 with: - distribution: 'adopt' - java-version: '11.0.11+9' + distribution: 'temurin' + java-version: '11.0.14' + cache: 'maven' - name: Set up environment run: | sudo apt-get update -y || true diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index b120b5b91e..b332481a5d 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -14,20 +14,15 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v2 with: - distribution: 'adopt' - java-version: '11.0.11+9' + distribution: 'temurin' + java-version: '11.0.14' + cache: 'maven' - name: Cache SonarCloud packages uses: actions/cache@v1 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any diff --git a/dockerfiles/che/Dockerfile b/dockerfiles/che/Dockerfile index bbb0841198..dd21040e2c 100644 --- a/dockerfiles/che/Dockerfile +++ b/dockerfiles/che/Dockerfile @@ -1,18 +1,37 @@ -# Copyright (c) 2012-2019 Red Hat, Inc. +# Copyright (c) 2018-2022 Red Hat, Inc. # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 # which is available at https://www.eclipse.org/legal/epl-2.0/ # # SPDX-License-Identifier: EPL-2.0 # +# Contributors: +# Red Hat, Inc. - initial API and implementation +# -FROM docker.io/adoptopenjdk/openjdk11:jre-11.0.11_9 -ENV LANG=C.UTF-8 -RUN echo "%root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && rm -rf /tmp/* -EXPOSE 8000 8080 +# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8-minimal +FROM registry.access.redhat.com/ubi8-minimal:8.5-230 +USER root +ENV CHE_HOME=/home/user/eclipse-che +ENV JAVA_HOME=/usr/lib/jvm/jre +RUN microdnf install java-11-openjdk-headless-1:11.0.14.0.9-2.el8_5.x86_64 tar gzip shadow-utils findutils && \ + microdnf update -y gnutls && \ + microdnf -y clean all && rm -rf /var/cache/yum && echo "Installed Packages" && rpm -qa | sort -V && echo "End Of Installed Packages" && \ + adduser -G root user && mkdir -p /home/user/eclipse-che COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -RUN mkdir /logs /data && \ - chmod 0777 /logs /data + ADD eclipse-che /home/user/eclipse-che -RUN find /home/user -type d -exec chmod 777 {} \; +# this should fail if the startup script is not found in correct path /home/user/eclipse-che/tomcat/bin/catalina.sh +RUN mkdir /logs /data && \ + chmod 0777 /logs /data && \ + chgrp -R 0 /home/user /logs /data && \ + chown -R user /home/user && \ + chmod -R g+rwX /home/user && \ + find /home/user -type d -exec chmod 777 {} \; && \ + java -version && echo -n "Server startup script in: " && \ + find /home/user/eclipse-che -name catalina.sh | grep -z /home/user/eclipse-che/tomcat/bin/catalina.sh + +USER user + +# append Brew metadata here diff --git a/dockerfiles/che/rhel.Dockerfile b/dockerfiles/che/rhel.Dockerfile deleted file mode 100644 index 69c2019a2b..0000000000 --- a/dockerfiles/che/rhel.Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2018-2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Red Hat, Inc. - initial API and implementation -# - -# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8-minimal -FROM registry.access.redhat.com/ubi8-minimal:8.5-230 -USER root -ENV CHE_HOME=/home/user/eclipse-che -ENV JAVA_HOME=/usr/lib/jvm/jre -RUN microdnf install java-11-openjdk-headless tar gzip shadow-utils findutils && \ - microdnf update -y gnutls && \ - microdnf -y clean all && rm -rf /var/cache/yum && echo "Installed Packages" && rpm -qa | sort -V && echo "End Of Installed Packages" && \ - adduser -G root user && mkdir -p /home/user/eclipse-che -COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] - -ADD eclipse-che /home/user/eclipse-che -# this should fail if the startup script is not found in correct path /home/user/eclipse-che/tomcat/bin/catalina.sh -RUN mkdir /logs /data && \ - chmod 0777 /logs /data && \ - chgrp -R 0 /home/user /logs /data && \ - chown -R user /home/user && \ - chmod -R g+rwX /home/user && \ - find /home/user -type d -exec chmod 777 {} \; && \ - java -version && echo -n "Server startup script in: " && \ - find /home/user/eclipse-che -name catalina.sh | grep -z /home/user/eclipse-che/tomcat/bin/catalina.sh - -USER user - -# append Brew metadata here