-
-
Notifications
You must be signed in to change notification settings - Fork 216
97 lines (83 loc) · 2.81 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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_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 }}
- 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 }}
uses: docker/[email protected]
id: login-hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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 }}
build_native_buildpacks_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-buildpacks'
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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
- name: Login to Docker Registry
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
uses: docker/[email protected]
id: login-hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push the native (GraalVM) Docker image
run: |
docker push --all-tags ${{ env.DOCKER_IMAGE_NAME }}