55
55
env :
56
56
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57
57
58
- docker_push :
59
- name : Docker Build & Push
58
+ docker_build :
59
+ name : Docker Build
60
60
runs-on : ubuntu-latest
61
61
needs : [test]
62
62
@@ -71,15 +71,44 @@ jobs:
71
71
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
72
72
echo "NOW=$(date --utc +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
73
73
74
- - name : Build & push Docker image to ghcr.io
75
- uses : mr-smithers-excellent/docker-build-push@v6
74
+ - name : Cache Docker layers
75
+ uses : actions/cache@v3
76
+ with :
77
+ path : /tmp/.buildx-cache
78
+ key : ${{ runner.os }}-buildx-${{ github.sha }}
79
+ restore-keys : |
80
+ ${{ runner.os }}-buildx-
81
+
82
+ - name : Set up QEMU
83
+ uses : docker/setup-qemu-action@v3
84
+
85
+ - name : Set up Docker Buildx
86
+ uses : docker/setup-buildx-action@v3
87
+
88
+ - name : Login to GitHub Container Registry
89
+ uses : docker/login-action@v3
76
90
with :
77
- image : git-sync
78
- tags : ${{ env.RELEASE_VERSION }},latest
79
91
registry : ghcr.io
80
- multiPlatform : true
81
- platform : linux/amd64,linux/arm64,linux/arm/v7
82
92
username : ${{ github.actor }}
83
93
password : ${{ secrets.GITHUB_TOKEN }}
84
- buildArgs : ' VERSION=${{ env.RELEASE_VERSION }},BUILD=${{ env.NOW }}'
85
94
95
+ - name : Build & push Docker image to ghcr.io
96
+ uses : docker/build-push-action@v4
97
+ with :
98
+ context : .
99
+ push : true
100
+ tags : |
101
+ - ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}
102
+ - ghcr.io/${{ github.repository }}:latest
103
+ platforms : |
104
+ - linux/amd64
105
+ - linux/arm64
106
+ - linux/arm/v7
107
+ build-args : |
108
+ VERSION=${{ env.RELEASE_VERSION }}
109
+ BUILD_DATE=${{ env.NOW }}
110
+ cache-from : type=local,src=/tmp/.buildx-cache
111
+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
112
+
113
+ - name : Move new cache to old cache
114
+ run : mv /tmp/.buildx-cache-new /tmp/.buildx-cache
0 commit comments