1+ name : Docker Image CI
2+
3+ on :
4+ release :
5+ types : [created]
6+
7+ env :
8+ DOCKER_IMAGE_NAME : missuo/deeplx-bot
9+ GHCR_IMAGE_NAME : ${{ github.repository }}
10+ DOCKER_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
11+ DOCKER_PASSWORD : ${{ secrets.DOCKERHUB_PASSWORD }}
12+ GHCR_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13+ GHCR_USERNAME : ${{ github.repository_owner }}
14+
15+ jobs :
16+ docker_build :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v3
21+ with :
22+ fetch-depth : 0
23+
24+ - name : Set up QEMU
25+ uses : docker/setup-qemu-action@v2
26+ with :
27+ platforms : all
28+
29+ - name : Set up docker buildx
30+ id : buildx
31+ uses : docker/setup-buildx-action@v2
32+ with :
33+ version : latest
34+
35+ - name : Login to DockerHub
36+ uses : docker/login-action@v2
37+ with :
38+ registry : docker.io
39+ username : ${{ env.DOCKER_USERNAME }}
40+ password : ${{ env.DOCKER_PASSWORD }}
41+
42+ - name : Login to GHCR
43+ uses : docker/login-action@v2
44+ with :
45+ registry : ghcr.io
46+ username : ${{ env.GHCR_USERNAME }}
47+ password : ${{ env.GHCR_TOKEN }}
48+
49+ - name : Docker meta
50+ id : meta
51+ uses : docker/metadata-action@v4
52+ with :
53+ images : |
54+ docker.io/${{ env.DOCKER_IMAGE_NAME }}
55+ ghcr.io/${{ env.GHCR_IMAGE_NAME }}
56+ tags : |
57+ type=ref,event=tag
58+ type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
59+ type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
60+
61+ - name : Build and push
62+ uses : docker/build-push-action@v3
63+ with :
64+ context : .
65+ platforms : linux/amd64,linux/arm64
66+ push : true
67+ tags : ${{ steps.meta.outputs.tags }}
68+ labels : ${{ steps.meta.outputs.labels }}
69+ cache-from : type=gha
70+ cache-to : type=gha,mode=max
0 commit comments