-
Notifications
You must be signed in to change notification settings - Fork 12
101 lines (92 loc) · 2.73 KB
/
Copy pathdockerNative.yml
File metadata and controls
101 lines (92 loc) · 2.73 KB
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
98
99
100
101
name: Build Docker Native Image
permissions:
contents: read
on:
workflow_dispatch:
inputs:
ref:
description: Git ref to build. Defaults to the selected workflow ref.
required: false
type: string
version:
description: Version tag to publish, for example v0.2.1.
required: false
type: string
publish-latest:
description: Also publish the latest-native tag.
required: false
default: true
type: boolean
workflow_call:
inputs:
ref:
description: Git ref to build.
required: true
type: string
version:
description: Version tag to publish, for example v0.2.1.
required: true
type: string
publish-latest:
description: Also publish the latest-native tag.
required: false
default: true
type: boolean
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref || github.ref }}
- name: Setup Java
id: setup_java
uses: graalvm/setup-graalvm@v1
with:
java-version: '25'
distribution: 'graalvm'
- name: Build Backend Application
run: |
chmod +x mvnw
./mvnw -B clean install -DskipTests
./mvnw -B package -pl sendium-app -Pnative -Dquarkus.native.container-build=false
- name: Log in to DockerHub
uses: docker/login-action@v4.6.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare Docker tags
id: docker_tags
shell: bash
run: |
version="${{ inputs.version }}"
tags=""
if [[ -n "${version}" ]]; then
tags="cytechmobile/sendium:${version}-native"
tags="${tags}"$'\n'"cytechmobile/sendium:${version#v}-native"
fi
if [[ "${{ inputs.publish-latest }}" == "true" || -z "${tags}" ]]; then
if [[ -n "${tags}" ]]; then
tags="${tags}"$'\n'"cytechmobile/sendium:latest-native"
else
tags="cytechmobile/sendium:latest-native"
fi
fi
{
echo 'tags<<EOF'
echo "${tags}"
echo EOF
} >> "${GITHUB_OUTPUT}"
- name: Build and Push Docker Image
uses: docker/build-push-action@v7
with:
context: ./sendium-app
file: ./sendium-app/src/main/docker/Dockerfile.native
push: true
tags: ${{ steps.docker_tags.outputs.tags }}