-
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 branch 'master' into dependabot/github_actions/docker/setup-bui…
…ldx-action-2
- Loading branch information
Showing
24 changed files
with
276 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,50 @@ | ||
# Simple demo app for k8s | ||
The goal is to have a simple app which can be used to demonstrate some features you can use in k8s. | ||
|
||
The goal is to have a simple app that can be used to demonstrate some features you can use in k8s. | ||
|
||
This demo app uses spring boot and a h2-database as technologies. | ||
|
||
## Features | ||
- endpoint for heath check, which can be controled via environment variable | ||
- endpoint for readiness check, which can be controled via rest endpoint | ||
|
||
- endpoint for a health check, which can be controlled via environment variable | ||
- endpoint for a readiness check, which can be controlled via rest endpoint | ||
- background-color and some text customizable via spring config | ||
|
||
## Running | ||
|
||
Run with docker | ||
```shell | ||
docker run -p 8080:8080 viadee/k8s-demo-app:latest | ||
docker run -p 8080:8080 public.ecr.aws/viadee/k8s-demo-app:latest | ||
``` | ||
|
||
Then browse to ```http://localhost:8080``` | ||
Then browse to `http://localhost:8080` | ||
|
||
Or build and run with maven locally: | ||
|
||
```shell | ||
mvn spring-boot:run | ||
``` | ||
|
||
## Building | ||
This is a simple maven project. Just run ```maven package```. | ||
|
||
Or just do a local docker build: ```docker build -t imagename .``` | ||
This is a simple maven project. Just run `maven package`. | ||
|
||
Or just do a local docker build: `docker build -t imagename .` | ||
Then you can run the container locally. | ||
|
||
|
||
## Native Build in github Codespaces | ||
|
||
```shell | ||
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 | ||
```shell | ||
./target/k8s-demo-app | ||
./target/k8s-demo-app --spring.profiles.active=red | ||
``` |
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
Oops, something went wrong.