From a9441c243fd270c571d7a5feb5c1d93a9ee347d3 Mon Sep 17 00:00:00 2001 From: Hans Petter Simonsen Date: Fri, 23 Feb 2024 13:04:29 +0100 Subject: [PATCH] Upgrade java to 21 and bump actions (#92) * dummy commit * temurin java 21 * Bump actions * Bump more in gh actions * Bump dockerimage to java 21 distroless --------- Co-authored-by: sigurdgroneng --- .github/workflows/deploy.yaml | 10 +++++----- .github/workflows/feature-branch-deploy.yaml | 19 +++++++------------ .github/workflows/naisdeploy.yaml | 9 +-------- .github/workflows/sonar.yaml | 17 ++++++----------- Dockerfile | 11 ++++++++++- 5 files changed, 29 insertions(+), 37 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index f0d08aa1..eb3d6a60 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -23,21 +23,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 cache: 'maven' - name: Build maven artifacts run: mvn -B package - - uses: docker/login-action@v2 + - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v3 + - uses: docker/build-push-action@v5 with: context: . push: true diff --git a/.github/workflows/feature-branch-deploy.yaml b/.github/workflows/feature-branch-deploy.yaml index a2e7b501..8c916438 100644 --- a/.github/workflows/feature-branch-deploy.yaml +++ b/.github/workflows/feature-branch-deploy.yaml @@ -20,26 +20,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 - - name: Set up cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-maven- + java-version: 21 + cache: 'maven' - name: Build maven artifacts run: mvn -B package - - uses: docker/login-action@v2 + - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v3 + - uses: docker/build-push-action@v5 with: context: . push: true diff --git a/.github/workflows/naisdeploy.yaml b/.github/workflows/naisdeploy.yaml index 30402e2b..1a859aca 100644 --- a/.github/workflows/naisdeploy.yaml +++ b/.github/workflows/naisdeploy.yaml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Deploy application to ${{ inputs.environment }} uses: nais/deploy/actions/deploy@v1 env: @@ -24,10 +24,3 @@ jobs: CLUSTER: ${{ inputs.environment }}-gcp RESOURCE: .nais/nais-${{ inputs.environment }}.yaml VAR: version=${{ github.sha }} - - name: Create release for prod - uses: softprops/action-gh-release@v1 - if: inputs.environment == 'prod' - with: - name: Release to prod - tag_name: release/prod@${{ github.sha }} - prerelease: false diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 695ce7c5..8c73285f 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -10,20 +10,15 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 17 - uses: actions/setup-java@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - java-version: 17 - distribution: 'temurin' - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 + java-version: 21 + distribution: 'temurin' #version? + cache: 'maven' - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any diff --git a/Dockerfile b/Dockerfile index b14abf72..da0ac553 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,11 @@ -FROM ghcr.io/navikt/poao-baseimages/java:17 +FROM busybox:1.36.1-uclibc as busybox +FROM gcr.io/distroless/java21-debian12:nonroot + +COPY --from=busybox /bin/sh /bin/sh +COPY --from=busybox /bin/printenv /bin/printenv + +WORKDIR /app COPY /target/aktivitet-arena-acl.jar app.jar +ENV TZ="Europe/Oslo" +EXPOSE 8080 +CMD ["app.jar"]