88 types : [published]
99
1010jobs :
11- build-and-push :
11+ build-amd64 :
1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Checkout code
1515 uses : actions/checkout@v3
1616
17- - name : Set up QEMU
18- uses : docker/setup-qemu-action@v2
17+ - name : Set up Docker Buildx
18+ uses : docker/setup-buildx-action@v2
19+ with :
20+ install : true
21+
22+ - name : Log in to DockerHub
23+ uses : docker/login-action@v2
24+ with :
25+ username : ${{ secrets.DOCKER_USERNAME }}
26+ password : ${{ secrets.DOCKER_PASSWORD }}
27+
28+ - name : Extract version from release tag
29+ if : github.event_name == 'release'
30+ id : version
31+ run : echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
32+
33+ - name : Build and push AMD64 Docker image
34+ if : github.ref == 'refs/heads/master' && github.event_name == 'push'
35+ run : |
36+ DOCKERFILE=app.dockerfile
37+ IMAGE_NAME=perplexica
38+ docker buildx build --platform linux/amd64 \
39+ --cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:amd64 \
40+ --cache-to=type=inline \
41+ -f $DOCKERFILE \
42+ -t itzcrazykns1337/${IMAGE_NAME}:amd64 \
43+ --push .
44+
45+ - name : Build and push AMD64 release Docker image
46+ if : github.event_name == 'release'
47+ run : |
48+ DOCKERFILE=app.dockerfile
49+ IMAGE_NAME=perplexica
50+ docker buildx build --platform linux/amd64 \
51+ --cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}-amd64 \
52+ --cache-to=type=inline \
53+ -f $DOCKERFILE \
54+ -t itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}-amd64 \
55+ --push .
56+
57+ build-arm64 :
58+ runs-on : ubuntu-24.04-arm
59+ steps :
60+ - name : Checkout code
61+ uses : actions/checkout@v3
1962
2063 - name : Set up Docker Buildx
2164 uses : docker/setup-buildx-action@v2
@@ -33,28 +76,54 @@ jobs:
3376 id : version
3477 run : echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
3578
36- - name : Build and push Docker image
79+ - name : Build and push ARM64 Docker image
3780 if : github.ref == 'refs/heads/master' && github.event_name == 'push'
3881 run : |
39- docker buildx create --use
40- DOCKERFILE=app.dockerfile; \
41- IMAGE_NAME=perplexica; \
42- docker buildx build --platform linux/amd64,linux/arm64 \
43- --cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:main \
82+ DOCKERFILE=app.dockerfile
83+ IMAGE_NAME=perplexica
84+ docker buildx build --platform linux/arm64 \
85+ --cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:arm64 \
4486 --cache-to=type=inline \
4587 -f $DOCKERFILE \
46- -t itzcrazykns1337/${IMAGE_NAME}:main \
88+ -t itzcrazykns1337/${IMAGE_NAME}:arm64 \
4789 --push .
4890
49- - name : Build and push release Docker image
91+ - name : Build and push ARM64 release Docker image
5092 if : github.event_name == 'release'
5193 run : |
52- docker buildx create --use
53- DOCKERFILE=app.dockerfile; \
54- IMAGE_NAME=perplexica; \
55- docker buildx build --platform linux/amd64,linux/arm64 \
56- --cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
94+ DOCKERFILE=app.dockerfile
95+ IMAGE_NAME=perplexica
96+ docker buildx build --platform linux/arm64 \
97+ --cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}-arm64 \
5798 --cache-to=type=inline \
5899 -f $DOCKERFILE \
59- -t itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
100+ -t itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}-arm64 \
60101 --push .
102+
103+ manifest :
104+ needs : [build-amd64, build-arm64]
105+ runs-on : ubuntu-latest
106+ steps :
107+ - name : Log in to DockerHub
108+ uses : docker/login-action@v2
109+ with :
110+ username : ${{ secrets.DOCKER_USERNAME }}
111+ password : ${{ secrets.DOCKER_PASSWORD }}
112+
113+ - name : Create and push multi-arch manifest for main
114+ if : github.ref == 'refs/heads/master' && github.event_name == 'push'
115+ run : |
116+ IMAGE_NAME=perplexica
117+ docker manifest create itzcrazykns1337/${IMAGE_NAME}:main \
118+ --amend itzcrazykns1337/${IMAGE_NAME}:amd64 \
119+ --amend itzcrazykns1337/${IMAGE_NAME}:arm64
120+ docker manifest push itzcrazykns1337/${IMAGE_NAME}:main
121+
122+ - name : Create and push multi-arch manifest for releases
123+ if : github.event_name == 'release'
124+ run : |
125+ IMAGE_NAME=perplexica
126+ docker manifest create itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
127+ --amend itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}-amd64 \
128+ --amend itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}-arm64
129+ docker manifest push itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }}
0 commit comments