Skip to content

Commit dfbf5b5

Browse files
committed
Container publish workflow review
1 parent 9ccf08c commit dfbf5b5

File tree

3 files changed

+88
-58
lines changed

3 files changed

+88
-58
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# CI docker build native
2+
3+
name: CI docker build native
4+
5+
# this workflow is responsible for building the native container image for this project by :
6+
#
7+
# 1. build the amd64/arm64 native executables (GraalVM) container images
8+
# 2. create the multi-platform PGO image (linux/amd64 and linux/arm64)
9+
#
10+
# NOTE: The linux/arm64 image is likely to work on Apple Silicon architecture too.
11+
12+
permissions:
13+
contents: read
14+
15+
on:
16+
# triggers on develop
17+
push:
18+
branches:
19+
- develop
20+
# triggers on a new release
21+
release:
22+
types: [published]
23+
24+
# only allow one workflow at time on the give activation
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
# building native executables
31+
build-native-image:
32+
name: Build native image
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [ 'ubuntu-24.04', 'ubuntu-24.04-arm' ]
37+
include:
38+
- os: ubuntu-24.04
39+
current_platform: 'amd64'
40+
- os: ubuntu-24.04-arm
41+
current_platform: 'arm64'
42+
steps:
43+
- name: 'print os'
44+
run: echo ${{ matrix.os }}
45+
- name: 'print current platform'
46+
run: echo ${{ matrix.current_platform }}
47+
- uses: fugerit-org/psychic-actions/maven-container-publish@mcp
48+
with:
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
java-type: 'native'
51+
java-distribution: 'graalvm'
52+
java-version: '23'
53+
maven-options: 'clean package -Dnative -Dquarkus.native.container-build=true'
54+
docker-file: './src/main/docker/Dockerfile.native-micro'
55+
docker-platforms: linux/${{ matrix.current_platform }}
56+
docker-tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:${{ github.ref_name }}-${{ matrix.current_platform }}native,${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-${{ matrix.current_platform }}native
57+
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
58+
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
59+
# creating multi-platform image
60+
build-docker-image:
61+
name: Build multi platform native image
62+
needs: [build-native-image]
63+
runs-on: ubuntu-24.04
64+
steps:
65+
- name: Build native image
66+
run: echo "build native image start"
67+
- name: Login to Docker Hub
68+
uses: docker/login-action@master
69+
with:
70+
username: ${{ secrets.DOCKERHUB_USERNAME }}
71+
password: ${{ secrets.DOCKERHUB_TOKEN }}
72+
- name: Pull latest amd64 image
73+
run: docker pull --platform linux/amd64 ${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-amd64native
74+
- name: Pull latest arm64 image
75+
run: docker pull --platform linux/arm64 ${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-arm64native
76+
- name: Create multi platform image latest (amd64/arm64)
77+
run: |
78+
docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-native \
79+
${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-amd64native \
80+
${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-arm64native
81+
- name: Create multi platform image current (amd64/arm64)
82+
# using the latest tag as at this time should be an alias for ${{ github.ref_name }}
83+
run: |
84+
docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:${{ github.ref_name }}-native \
85+
${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-amd64native \
86+
${{ secrets.DOCKERHUB_USERNAME }}/${{github.event.repository.name}}:latest-arm64native
87+
- name: Build native image
88+
run: echo "build native image end"

.github/workflows/docker_publish_native_amd64.yml

-29
This file was deleted.

.github/workflows/docker_publish_native_arm64.yml

-29
This file was deleted.

0 commit comments

Comments
 (0)