1- name : Docker Image CI
1+ name : Build Docker image
22
33on :
44 push :
5- branches : ["main", "develop"]
6- pull_request :
7- branches : ["main", "develop"]
8-
9- env :
10- GHCR_REGISTRY : ghcr.io
11- DOCKERHUB_REGISTRY : docker.io
12- IMAGE_NAME : ${{ github.repository }}
13- DOCKERHUB_IMAGE : evoapicloud/evo-ai
5+ tags :
6+ - " *.*.*"
147
158jobs :
16- build-and-push :
9+ build_deploy :
10+ name : Build and Deploy
1711 runs-on : ubuntu-latest
1812 permissions :
1913 contents : read
2014 packages : write
21-
2215 steps :
23- - name : Checkout repository
16+ - name : Checkout
2417 uses : actions/checkout@v4
2518
26- - name : Log in to GitHub Container Registry
27- uses : docker/login-action@v3
28- with :
29- registry : ${{ env.GHCR_REGISTRY }}
30- username : ${{ github.actor }}
31- password : ${{ secrets.GITHUB_TOKEN }}
32-
33- - name : Log in to Docker Hub
34- uses : docker/login-action@v3
35- with :
36- registry : ${{ env.DOCKERHUB_REGISTRY }}
37- username : ${{ secrets.DOCKERHUB_USERNAME }}
38- password : ${{ secrets.DOCKERHUB_TOKEN }}
39-
40- - name : Extract metadata for Docker
19+ - name : Docker meta
4120 id : meta
4221 uses : docker/metadata-action@v5
4322 with :
44- images : |
45- ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
46- ${{ env.DOCKERHUB_REGISTRY }}/${{ env.DOCKERHUB_IMAGE }}
47- tags : |
48- type=raw,value=develop,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }}
49- type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
50- type=sha
51- type=ref,event=branch
52- type=ref,event=tag
23+ images : evoapicloud/evo-ai
24+ tags : type=semver,pattern=v{{version}}
25+
26+ - name : Set up QEMU
27+ uses : docker/setup-qemu-action@v3
5328
5429 - name : Set up Docker Buildx
5530 uses : docker/setup-buildx-action@v3
5631
32+ - name : Login to GitHub Container Registry
33+ uses : docker/login-action@v3
34+ with :
35+ username : ${{ secrets.DOCKER_USERNAME }}
36+ password : ${{ secrets.DOCKER_PASSWORD }}
37+
5738 - name : Build and push
39+ id : docker_build
5840 uses : docker/build-push-action@v5
5941 with :
60- context : .
61- push : ${{ github.event_name != 'pull_request' }}
42+ platforms : linux/amd64,linux/arm64
43+ push : true
6244 tags : ${{ steps.meta.outputs.tags }}
6345 labels : ${{ steps.meta.outputs.labels }}
64- cache-from : type=gha
65- cache-to : type=gha,mode=max
46+
47+ - name : Image digest
48+ run : echo ${{ steps.docker_build.outputs.digest }}
0 commit comments