@@ -2,7 +2,8 @@ name: docker-build
22
33on :
44 push :
5- pull_request :
5+ branches :
6+ - main
67
78jobs :
89 multi-arch-push :
1112 -
1213 name : Checkout
1314 uses : actions/checkout@v4
15+ with :
16+ fetch-depth : 0
1417 -
1518 name : Set up Docker Buildx
1619 uses : docker/setup-buildx-action@v3
20+ -
21+ name : Cache Docker layers
22+ uses : actions/cache@v4
23+ with :
24+ path : /tmp/.buildx-cache
25+ key : ${{ runner.os }}-buildx-${{ github.sha }}
26+ restore-keys : |
27+ ${{ runner.os }}-buildx-
1728 -
1829 name : Login to GitHub Registry
1930 uses : docker/login-action@v3
@@ -28,12 +39,21 @@ jobs:
2839 username : erisamoe
2940 password : ${{ secrets.DOCKERHUB_TOKEN }}
3041 -
31- name : Bake image
32- uses : docker/bake-action@v6
33- env :
34- MULTI_PLATFORM : true
42+ name : Get Latest Tag
43+ id : previoustag
44+ uses :
WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # [email protected] 45+ -
46+ name : Build and push
47+ uses : docker/build-push-action@v5
3548 with :
36- push : ${{ github.ref == 'ref/heads/main' }}
37- set : |
38- *.cache-from=type=gha
39- *.cache-to=type=gha,mode=max
49+ context : .
50+ file : ./Dockerfile
51+ platforms : linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
52+ push : true
53+ tags : |
54+ erisamoe/cloudflared:latest
55+ erisamoe/cloudflared:${{ steps.previoustag.outputs.tag }}
56+ ghcr.io/erisa/cloudflared:latest
57+ ghcr.io/erisa/cloudflared:${{ steps.previoustag.outputs.tag }}
58+ cache-from : type=local,src=/tmp/.buildx-cache
59+ cache-to : type=local,dest=/tmp/.buildx-cache
0 commit comments