-
-
Notifications
You must be signed in to change notification settings - Fork 214
67 lines (58 loc) · 2.08 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
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-24.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@v4
with:
distribution: 'oracle'
java-version: '21'
check-latest: false
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build application with Buildpacks
run: |
./mvnw -Pnative -DskipTests clean spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.DOCKER_IMAGE_NAME }} -Ddevelocity.cache.remote.enabled=false
- name: Test native image
working-directory: tests-ci
run: ./start_docker_container.sh ${{ 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 }}