Skip to content

Commit

Permalink
Merge pull request #2 from cl-a-us/test
Browse files Browse the repository at this point in the history
Merge update actions to java 17
  • Loading branch information
cl-a-us authored Oct 16, 2024
2 parents 2b30d85 + 29d7316 commit 7b1a20c
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 31 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/build_push_to_ecr.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: build release and push to ECR
on:
on:
release:
types: [prereleased, released]
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3


- name: Login to Public ECR
uses: docker/login-action@v1
with:
Expand All @@ -19,16 +17,16 @@ jobs:
password: ${{ secrets.AWS_PROD_ECR_VIADEE_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Set up JDK 1.11
uses: actions/setup-java@v3
with:
distribution: 'adopt' # See 'Supported distributions' for available options
java-version: '11'
distribution: "adopt" # See 'Supported distributions' for available options
java-version: "11"

- name: Cache local Maven repository
uses: actions/cache@v2
with:
Expand All @@ -40,9 +38,7 @@ jobs:
- name: Maven package
run: mvn package -B


-
name: Docker meta
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
Expand All @@ -60,5 +56,4 @@ jobs:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

labels: ${{ steps.meta.outputs.labels }}
25 changes: 12 additions & 13 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "liberica"
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:11-slim
FROM openjdk:17-slim
COPY target/k8s-demo-app.jar app.jar
RUN groupadd -g 1000 appuser && \
useradd -u 1000 -g 1000 appuser
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.Multistage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.6-jdk-11-slim as build_container
FROM maven:3.8-openjdk-17-slim as build_container

WORKDIR /build
COPY pom.xml .
Expand All @@ -8,7 +8,7 @@ COPY . /usr/src/build
WORKDIR /usr/src/build
RUN mvn package -B

FROM openjdk:11-slim
FROM openjdk:17-slim
COPY --from=build_container /usr/src/build/target/k8s-demo-app.jar app.jar
RUN groupadd -g 1000 appuser && \
useradd -u 1000 -g 1000 appuser
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ mvn clean
# 'package' contains step 'process-aot' which is needed for native:compile
mvn package -Pnative
mvn native:compile
# If "[1/8] Initializing..." fails, it might be due to a lag of resources. Try increasing the VM resources.
```

### start native build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package de.viadee.k8s.testapp.counter;

import com.zaxxer.hikari.HikariDataSource;

import java.sql.Timestamp;
import java.util.Optional;

import jakarta.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ public String throwException() {
LOG.error("log exception on error level", runtimeException);
throw runtimeException;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ public ResponseEntity<String> checkReadiness(@RequestParam(required = false, nam
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).build();
}
}

}

0 comments on commit 7b1a20c

Please sign in to comment.