-
-
Notifications
You must be signed in to change notification settings - Fork 216
58 lines (51 loc) · 1.71 KB
/
publish-native-docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build and publish native (GraalVM) images
on:
push:
branches:
- graalvm
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 }}/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 }}
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '21'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Build application with GraalVM
# to test the GraalVM Build using DevContainers, install GraalVM by running `sdk install java 21.0.1-graal`
run: |
./mvnw -Pnative native:compile -DskipTests
- name: Login to Docker Registry
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{env.DOCKERHUB_USERNAME != '' && startsWith(github.ref, 'refs/tags/v')}}
uses: docker/[email protected]
id: login-hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the native (GraalVM) Docker image
uses: docker/build-push-action@v5
with:
file: ./src/main/docker/Dockerfile.native
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}