Skip to content

Commit

Permalink
Merge pull request #8127 from jdubois/graalvm
Browse files Browse the repository at this point in the history
Native (GraalVM) automated builds
  • Loading branch information
pascalgrimaud authored Nov 22, 2023
2 parents 2e30853 + 5b3d400 commit b30a87a
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 102 deletions.
22 changes: 0 additions & 22 deletions .devcontainer/Dockerfile

This file was deleted.

45 changes: 32 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
{
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "21-bookworm",
"INSTALL_MAVEN": "true",
"MAVEN_VERSION": "3.9.5",
"INSTALL_GRADLE": "false",
"NODE_VERSION": "lts/*"
}
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "21-oracle",
"jdkDistro": "oracle"
},
"ghcr.io/devcontainers/features/node:1": {},
"docker-in-docker": "latest",
"github-cli": "latest",
"terraform": "latest"
},
"settings": {
"java.home": "/docker-java-home",
"maven.executable.path": "/usr/local/sdkman/candidates/maven/current/bin/mvn"

"customizations": {
"vscode": {
"settings": {},
"extensions": [
"dawhite.mustache",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"github.vscode-pull-request-github",
"hashicorp.terraform",
"ms-azuretools.vscode-azureterraform",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-vscode.vscode-node-azure-pack",
"ms-vsliveshare.vsliveshare",
"redhat.fabric8-analytics",
"redhat.vscode-xml",
"streetsidesoftware.code-spell-checker",
"visualstudioexptteam.vscodeintellicode",
"vscjava.vscode-java-pack"
]
}
},
"extensions": ["vscjava.vscode-java-pack"],

"forwardPorts": [7471],
"remoteUser": "vscode"
}
64 changes: 0 additions & 64 deletions .github/workflows/docker-image-publish.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/publish-jvm-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and publish JVM-based images
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- main

jobs:
build_jvm_docker_image:
name: Build and publish the JVM-based Docker image
runs-on: ubuntu-22.04
env:
DOCKER_IMAGE_NAME: '${{ github.repository_owner }}/jhipster-lite'

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.DOCKER_IMAGE_NAME }}

- name: Login to Docker Registry
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
uses: docker/[email protected]
id: login-hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build the JVM-based Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
56 changes: 56 additions & 0 deletions .github/workflows/publish-native-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and publish native (GraalVM) images
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- main

jobs:
build_native_docker_image:
name: Build and publish the native (GraalVM) Docker image
runs-on: ubuntu-22.04
env:
DOCKER_IMAGE_NAME: '${{ github.repository_owner }}/jhipster-lite-native'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.DOCKER_IMAGE_NAME }}

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '21'
check-latest: false
cache: 'maven'

- name: Build application with Buildpacks
run: |
./mvnw -Pnative -DskipTests clean spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.DOCKER_IMAGE_NAME }}
- name: Login to Docker Registry
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
uses: docker/[email protected]
id: login-hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Tag the native (GraalVM) Docker image and push it
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_NAME }}:latest
docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}
docker push --all-tags ${{ env.DOCKER_IMAGE_NAME }}
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ RUN \
useradd jhipster -s /bin/bash -m -g jhipster -G sudo && \
echo 'jhipster:jhipster'|chpasswd
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JAVA_OPTS="" \
SPRING_PROFILES_ACTIVE=cloud
JAVA_OPTS=""
USER jhipster
CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /code/*.jar
EXPOSE 7471
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@
<BP_JVM_VERSION>21</BP_JVM_VERSION>
</env>
<buildpacks>
<buildpack>gcr.io/paketo-buildpacks/bellsoft-liberica:9.11.0</buildpack>
<buildpack>gcr.io/paketo-buildpacks/bellsoft-liberica:10.4.3</buildpack>
<buildpack>gcr.io/paketo-buildpacks/java-native-image</buildpack>
</buildpacks>
</image>
Expand Down

0 comments on commit b30a87a

Please sign in to comment.