-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (74 loc) · 3.04 KB
/
spring-native.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
# This is a basic workflow to help you get started with Actions
name: Spring Native - Build docker image for AMD64 and AARCH64
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
if: contains(toJson(github), 'build docker-image')
name: Build and Publish Docker images to DockerHub
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
# Set up JDK 11
- name: JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Setup Graalvm(amd64)
uses: DeLaGuardo/setup-graalvm@master
with:
graalvm-version: '21.0.0.2.java11'
# Build the Docker image with Maven
- name: Build Docker Image(amd64)
run: |
mvn clean install spring-boot:build-image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
# Login to Dockerhub
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Push the Docker image amd64
- name: Push
run: |
docker tag spring-native-crud-mongodb:0.0.1-SNAPSHOT fielcapao/spring-native-crud-mongodb-amd64
docker push fielcapao/spring-native-crud-mongodb-amd64
docker rmi -f fielcapao/spring-native-crud-mongodb-amd64
- name: Setup Graalvm(aarch64)
uses: DeLaGuardo/setup-graalvm@new-parameters
with:
graalvm: '21.0.0.2'
java: 'java11'
arch: 'aarch64'
# Run commands on aarch64
- name: Run on aarch64
uses: uraimo/[email protected]
id: runcmd
with:
arch: aarch64
distro: ubuntu20.04
# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}
# Set an output parameter `uname` for use in subsequent steps
run: |
uname -a
echo ::set-output name=uname::$(uname -a)
# Build the Docker image with Maven
- name: Build Docker Image(aarch64)
run: |
mvn clean install spring-boot:build-image -DskipTests -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
# Push the Docker image aarch64
- name: Push
run: |
docker tag spring-native-crud-mongodb:0.0.1-SNAPSHOT fielcapao/spring-native-crud-mongodb-aarch64
docker push fielcapao/spring-native-crud-mongodb-aarch64