Skip to content

Commit 2cd01a5

Browse files
committedAug 3, 2023
feat: add sub images actions build
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
1 parent 095bfa7 commit 2cd01a5

File tree

2 files changed

+364
-7
lines changed

2 files changed

+364
-7
lines changed
 

‎.github/workflows/build-docker-image.yml

+44-7
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,36 @@ on:
2323
- v*
2424
workflow_dispatch:
2525

26+
env:
27+
# Common versions
28+
GO_VERSION: "1.20"
29+
2630
jobs:
27-
build:
31+
build-dockerhub:
2832
runs-on: ubuntu-latest
2933
steps:
30-
- name: Check out the repo
34+
- name: Checkout
3135
uses: actions/checkout@v3
32-
33-
- name: Build OpenIM Server
34-
run: |
35-
sudo make build
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@v2
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v2
3640

3741
# docker.io/openim/openim-server:latest
3842
- name: Extract metadata (tags, labels) for Docker
3943
id: meta
4044
uses: docker/metadata-action@v4.6.0
4145
with:
4246
images: openim/openim-server
47+
# generate Docker tags based on the following events/attributes
48+
tags: |
49+
type=schedule
50+
type=ref,event=branch
51+
type=ref,event=pr
52+
type=semver,pattern={{version}}
53+
type=semver,pattern={{major}}.{{minor}}
54+
type=semver,pattern={{major}}
55+
type=sha
4356
4457
- name: Log in to Docker Hub
4558
uses: docker/login-action@v2
@@ -51,10 +64,21 @@ jobs:
5164
uses: docker/build-push-action@v4
5265
with:
5366
context: .
67+
# linux/ppc64le,linux/s390x
68+
platforms: linux/amd64,linux/arm64
5469
push: ${{ github.event_name != 'pull_request' }}
5570
tags: ${{ steps.meta.outputs.tags }}
5671
labels: ${{ steps.meta.outputs.labels }}
5772

73+
build-aliyun:
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v3
78+
- name: Set up QEMU
79+
uses: docker/setup-qemu-action@v2
80+
- name: Set up Docker Buildx
81+
uses: docker/setup-buildx-action@v2
5882
# registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
5983
- name: Extract metadata (tags, labels) for Docker
6084
id: meta2
@@ -73,10 +97,21 @@ jobs:
7397
uses: docker/build-push-action@v4
7498
with:
7599
context: .
100+
# linux/ppc64le,linux/s390x
101+
platforms: linux/amd64,linux/arm64
76102
push: ${{ github.event_name != 'pull_request' }}
77103
tags: ${{ steps.meta2.outputs.tags }}
78104
labels: ${{ steps.meta2.outputs.labels }}
79105

106+
build-ghcr:
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@v3
111+
- name: Set up QEMU
112+
uses: docker/setup-qemu-action@v2
113+
- name: Set up Docker Buildx
114+
uses: docker/setup-buildx-action@v2
80115
# ghcr.io/openimsdk/openim-server:latest
81116
- name: Extract metadata (tags, labels) for Docker
82117
id: meta3
@@ -88,13 +123,15 @@ jobs:
88123
uses: docker/login-action@v2
89124
with:
90125
registry: ghcr.io
91-
username: ${{ github.actor }}
126+
username: ${{ github.repository_owner }}
92127
password: ${{ secrets.GITHUB_TOKEN }}
93128

94129
- name: Build and push Docker image
95130
uses: docker/build-push-action@v4
96131
with:
97132
context: .
133+
# linux/ppc64le,linux/s390x
134+
platforms: linux/amd64,linux/arm64
98135
push: ${{ github.event_name != 'pull_request' }}
99136
tags: ${{ steps.meta3.outputs.tags }}
100137
labels: ${{ steps.meta3.outputs.labels }}

0 commit comments

Comments
 (0)