-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.09 KB
/
docker-image.yml
File metadata and controls
75 lines (64 loc) · 2.09 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
name: Docker Image CI
on:
push:
branches: [ "main" ]
paths:
- 'Dockerfile'
- 'Dockerfile.deb'
- 'aipython/**'
- 'pyproject.toml'
pull_request:
branches: [ "main" ]
jobs:
build-amd64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build amd64 Image
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
push: true
file: Dockerfile
tags: ${{ secrets.DOCKERHUB_USERNAME }}/aipython:amd64-latest
build-arm64:
needs: build-amd64 # 确保在 amd64 构建完成后执行
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2 # 设置 ARM 架构支持
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build arm64 Image
uses: docker/build-push-action@v3
with:
platforms: linux/arm64
push: true
file: Dockerfile.deb
tags: ${{ secrets.DOCKERHUB_USERNAME }}/aipython:arm64-latest
manifest:
needs: [build-amd64, build-arm64]
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Create and Push Manifest List
run: |
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/aipython:latest \
--amend ${{ secrets.DOCKERHUB_USERNAME }}/aipython:amd64-latest \
--amend ${{ secrets.DOCKERHUB_USERNAME }}/aipython:arm64-latest
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/aipython:latest