1+ # This workflow builds and publishes official Docker images to Docker Hub.
2+ # It handles multi-platform builds (amd64, arm/v7, arm64/v8) and pushes tagged releases.
3+ # This workflow is triggered on tags, specific branches, and can be manually dispatched.
4+ # For quick build checks during development, see docker-check.yml
15name : Docker Push
26
37on :
@@ -38,21 +42,19 @@ jobs:
3842 LEGACY_IMAGE_NAME : ipfs/go-ipfs
3943 steps :
4044 - name : Check out the repo
41- uses : actions/checkout@v4
45+ uses : actions/checkout@v5
4246
4347 - name : Set up QEMU
4448 uses : docker/setup-qemu-action@v3
4549
4650 - name : Set up Docker Buildx
4751 uses : docker/setup-buildx-action@v3
4852
49- - name : Cache Docker layers
50- uses : actions/cache@v4
53+ - name : Log in to Docker Hub
54+ uses : docker/login-action@v3
5155 with :
52- path : /tmp/.buildx-cache
53- key : ${{ runner.os }}-buildx-${{ github.sha }}
54- restore-keys : |
55- ${{ runner.os }}-buildx-
56+ username : ${{ vars.DOCKER_USERNAME }}
57+ password : ${{ secrets.DOCKER_PASSWORD }}
5658
5759 - name : Get tags
5860 id : tags
6365 echo "EOF" >> $GITHUB_OUTPUT
6466 shell : bash
6567
66- - name : Log in to Docker Hub
67- uses : docker/login-action@v3
68- with :
69- username : ${{ vars.DOCKER_USERNAME }}
70- password : ${{ secrets.DOCKER_PASSWORD }}
71-
7268 # We have to build each platform separately because when using multi-arch
7369 # builds, only one platform is being loaded into the cache. This would
7470 # prevent us from testing the other platforms.
8177 load : true
8278 file : ./Dockerfile
8379 tags : ${{ env.IMAGE_NAME }}:linux-amd64
84- cache-from : type=local,src=/tmp/.buildx-cache
85- cache-to : type=local,dest=/tmp/.buildx-cache-new
80+ cache-from : |
81+ type=gha
82+ type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
83+ cache-to : type=gha,mode=max
8684
8785 - name : Build Docker image (linux/arm/v7)
8886 uses : docker/build-push-action@v6
9391 load : true
9492 file : ./Dockerfile
9593 tags : ${{ env.IMAGE_NAME }}:linux-arm-v7
96- cache-from : type=local,src=/tmp/.buildx-cache
97- cache-to : type=local,dest=/tmp/.buildx-cache-new
94+ cache-from : |
95+ type=gha
96+ type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
97+ cache-to : type=gha,mode=max
9898
9999 - name : Build Docker image (linux/arm64/v8)
100100 uses : docker/build-push-action@v6
@@ -105,8 +105,10 @@ jobs:
105105 load : true
106106 file : ./Dockerfile
107107 tags : ${{ env.IMAGE_NAME }}:linux-arm64-v8
108- cache-from : type=local,src=/tmp/.buildx-cache
109- cache-to : type=local,dest=/tmp/.buildx-cache-new
108+ cache-from : |
109+ type=gha
110+ type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
111+ cache-to : type=gha,mode=max
110112
111113 # We test all the images on amd64 host here. This uses QEMU to emulate
112114 # the other platforms.
@@ -132,12 +134,9 @@ jobs:
132134 push : true
133135 file : ./Dockerfile
134136 tags : " ${{ github.event.inputs.tags || steps.tags.outputs.value }}"
135- cache-from : type=local,src=/tmp/.buildx-cache-new
136- cache-to : type=local,dest=/tmp/.buildx-cache-new
137-
138- # https://github.com/docker/build-push-action/issues/252
139- # https://github.com/moby/buildkit/issues/1896
140- - name : Move cache to limit growth
141- run : |
142- rm -rf /tmp/.buildx-cache
143- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
137+ cache-from : |
138+ type=gha
139+ type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
140+ cache-to : |
141+ type=gha,mode=max
142+ type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
0 commit comments