Skip to content

Commit 2ef1a78

Browse files
committed
build(CI): 构建多平台镜像
1 parent dbcf9c8 commit 2ef1a78

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed
Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
name: Auto Deploy Docker
22

33
on:
4-
push:
5-
branches: [ "2.10","2.11" ]
4+
push:
5+
branches: [ "2.10","2.11" ]
66
jobs:
7-
build:
8-
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up JDK 17
14-
uses: actions/setup-java@v1
15-
with:
16-
java-version: 17
17-
- name: Cache Maven Repository
18-
uses: actions/cache@v3
19-
with:
20-
path: ~/.m2
21-
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
22-
- name: Build with Maven
23-
run: ./mvnw clean install -Dmaven.build.timestamp="$(date "+%Y-%m-%d %H:%M:%S")" -Dmaven.test.skip=true -Pbuild && cd jetlinks-standalone && docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) .
24-
- name: Login Docker Repo
25-
run: echo "${{ secrets.ALIYUN_DOCKER_REPO_PWD }}" | docker login registry.cn-shenzhen.aliyuncs.com -u ${{ secrets.ALIYUN_DOCKER_REPO_USERNAME }} --password-stdin
26-
- name: Push Docker
27-
run: docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up JDK 17
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 17
15+
- name: Cache Maven Repository
16+
uses: actions/cache@v3
17+
with:
18+
path: ~/.m2
19+
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
20+
- name: Build with Maven
21+
run: ./mvnw clean install -Dmaven.build.timestamp="$(date "+%Y-%m-%d %H:%M:%S")" -Dmaven.test.skip=true -Pbuild
22+
- name: Get Maven project version
23+
id: maven-version
24+
run: |
25+
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
26+
echo "version=$VERSION" >> $GITHUB_OUTPUT
27+
echo "Project version: $VERSION"
28+
- name: Log in to Aliyun ACR
29+
uses: docker/login-action@v3
30+
with:
31+
registry: registry.cn-shenzhen.aliyuncs.com
32+
username: ${{ secrets.ALIYUN_DOCKER_REPO_USERNAME }}
33+
password: ${{ secrets.ALIYUN_DOCKER_REPO_PWD }}
34+
- name: build and docker image
35+
uses: docker/build-push-action@v6
36+
with:
37+
context: ./jetlinks-standalone
38+
file: ./jetlinks-standalone/Dockerfile
39+
platforms: linux/amd64,linux/arm64/v8
40+
push: true
41+
tags: |
42+
registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:${{ steps.maven-version.outputs.version }}

0 commit comments

Comments
 (0)