1
+ name : Build and push tg-bot-docsgpt-extenstion Docker image
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main # Trigger on push to main branch
7
+
8
+ jobs :
9
+ build :
10
+ strategy :
11
+ matrix :
12
+ include :
13
+ - platform : linux/amd64
14
+ runner : ubuntu-latest
15
+ suffix : amd64
16
+ - platform : linux/arm64
17
+ runner : ubuntu-24.04-arm
18
+ suffix : arm64
19
+ runs-on : ${{ matrix.runner }}
20
+ permissions :
21
+ contents : read
22
+ packages : write
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+
26
+ - name : Set up QEMU # Only needed for emulation, not for native arm64 builds
27
+ uses : docker/setup-qemu-action@v3
28
+
29
+ - name : Set up Docker Buildx
30
+ uses : docker/setup-buildx-action@v3
31
+ with :
32
+ driver : docker-container
33
+ install : true
34
+
35
+ - name : Login to DockerHub
36
+ uses : docker/login-action@v3
37
+ with :
38
+ username : ${{ secrets.DOCKER_USERNAME }}
39
+ password : ${{ secrets.DOCKER_PASSWORD }}
40
+
41
+ - name : Login to ghcr.io
42
+ uses : docker/login-action@v3
43
+ with :
44
+ registry : ghcr.io
45
+ username : ${{ github.repository_owner }}
46
+ password : ${{ secrets.GITHUB_TOKEN }}
47
+
48
+ - name : Build and push platform-specific images
49
+ uses : docker/build-push-action@v6
50
+ with :
51
+ file : ' ./Dockerfile'
52
+ platforms : ${{ matrix.platform }}
53
+ context : .
54
+ push : true
55
+ tags : |
56
+ ${{ secrets.DOCKER_USERNAME }}/tg-bot-docsgpt-extenstion:latest-${{ matrix.suffix }}
57
+ ghcr.io/${{ github.repository_owner }}/tg-bot-docsgpt-extenstion:latest-${{ matrix.suffix }}
58
+ provenance : false
59
+ sbom : false
60
+ cache-from : type=registry,ref=${{ secrets.DOCKER_USERNAME }}/tg-bot-docsgpt-extenstion:latest
61
+ cache-to : type=inline
62
+
63
+ manifest :
64
+ needs : build
65
+ runs-on : ubuntu-latest
66
+ permissions :
67
+ packages : write
68
+ steps :
69
+ - name : Set up Docker Buildx
70
+ uses : docker/setup-buildx-action@v3
71
+ with :
72
+ driver : docker-container
73
+ install : true
74
+
75
+ - name : Login to DockerHub
76
+ uses : docker/login-action@v3
77
+ with :
78
+ username : ${{ secrets.DOCKER_USERNAME }}
79
+ password : ${{ secrets.DOCKER_PASSWORD }}
80
+
81
+ - name : Login to ghcr.io
82
+ uses : docker/login-action@v3
83
+ with :
84
+ registry : ghcr.io
85
+ username : ${{ github.repository_owner }}
86
+ password : ${{ secrets.GITHUB_TOKEN }}
87
+
88
+ - name : Create and push manifest for DockerHub
89
+ run : |
90
+ set -e
91
+ docker manifest create ${{ secrets.DOCKER_USERNAME }}/tg-bot-docsgpt-extenstion:latest \
92
+ --amend ${{ secrets.DOCKER_USERNAME }}/tg-bot-docsgpt-extenstion:latest-amd64 \
93
+ --amend ${{ secrets.DOCKER_USERNAME }}/tg-bot-docsgpt-extenstion:latest-arm64
94
+ docker manifest push ${{ secrets.DOCKER_USERNAME }}/tg-bot-docsgpt-extenstion:latest
95
+
96
+ - name : Create and push manifest for ghcr.io
97
+ run : |
98
+ set -e
99
+ docker manifest create ghcr.io/${{ github.repository_owner }}/tg-bot-docsgpt-extenstion:latest \
100
+ --amend ghcr.io/${{ github.repository_owner }}/tg-bot-docsgpt-extenstion:latest-amd64 \
101
+ --amend ghcr.io/${{ github.repository_owner }}/tg-bot-docsgpt-extenstion:latest-arm64
102
+ docker manifest push ghcr.io/${{ github.repository_owner }}/tg-bot-docsgpt-extenstion:latest
0 commit comments