-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from cl-a-us/master
Udate spring and provide spring native support with codespace
- Loading branch information
Showing
24 changed files
with
258 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// see https://github.com/microsoft/vscode-remote-try-java for detailed example on vscode remote java project | ||
{ | ||
"name": "dev-container-with-graalvm", | ||
// java images can be found here: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/java/about | ||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu", | ||
"features": { | ||
"ghcr.io/devcontainers/features/java:1": { | ||
// version is installed via sdkman | ||
// see https://sdkman.io/jdks#graalce and https://www.graalvm.org/downloads/ for version | ||
"version": "21-graalce", | ||
"installMaven": "true", | ||
"mavenVersion": "3.8.6", | ||
"installGradle": "false" | ||
} | ||
}, | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
"settings": {}, | ||
"extensions": [ | ||
"streetsidesoftware.code-spell-checker" | ||
] | ||
} | ||
} | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
, "postCreateCommand": "java -version" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
# 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 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "liberica" # See 'Supported distributions' for available options | ||
cache: 'maven' | ||
|
||
- name: Maven package | ||
run: mvn -B package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | ||
|
||
name: Java CI Native Build with Maven | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "graalvm" # See 'Supported distributions' for available options | ||
cache: 'maven' | ||
|
||
- name: Maven native build | ||
run: mvn package -Pnative native:compile | ||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: native-build | ||
path: target/k8s-demo-app | ||
retention-days: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: build release and push to ECR | ||
on: | ||
release: | ||
types: [prereleased, released] | ||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to Public ECR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: public.ecr.aws | ||
username: ${{ secrets.AWS_PROD_ECR_VIADEE_ACCESS_KEY_ID }} | ||
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 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "graalvm" # See 'Supported distributions' for available options | ||
cache: 'maven' | ||
|
||
- name: Maven native build | ||
run: mvn package -Pnative native:compile | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: public.ecr.aws/m4k8r3n4/k8s-demo-app-native | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/de/viadee/k8s/testapp/config/NativeReflectionRuntimeHintConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package de.viadee.k8s.testapp.config; | ||
|
||
import org.springframework.aot.hint.MemberCategory; | ||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.RuntimeHintsRegistrar; | ||
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportRuntimeHints; | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
@Configuration | ||
@RegisterReflectionForBinding(classes = {HashMap.class}) | ||
@ImportRuntimeHints(NativeReflectionRuntimeHintConfig.NativeRuntimeHints.class) | ||
@EnableWebMvc | ||
public class NativeReflectionRuntimeHintConfig { | ||
|
||
static class NativeRuntimeHints implements RuntimeHintsRegistrar { | ||
|
||
@Override | ||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) { | ||
|
||
// especially for rendering k8s_env.html | ||
hints.reflection().registerType(Map.Entry.class, MemberCategory.values()); | ||
// hints.reflection().registerType(HashMap.class, MemberCategory.values()); | ||
// Innere Klassen | ||
hints.reflection().registerTypeIfPresent(classLoader, "java.util.HashMap$Node" | ||
, MemberCategory.values()); | ||
|
||
hints.resources().registerPattern("META-INF/resources/webjars/bootstrap/5.3.3/css/bootstrap.min.css"); | ||
hints.resources().registerPattern("META-INF/resources/webjars/bootstrap/5.3.3/js/bootstrap.min.js"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.viadee.k8s.testapp.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
|
||
@Configuration | ||
@EnableWebMvc | ||
public class WebConfig implements WebMvcConfigurer { | ||
|
||
@Override | ||
public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); | ||
} | ||
|
||
} |
Oops, something went wrong.