Skip to content

Commit 1104ca1

Browse files
authored
ci : use registry cache for docker builds (ggml-org#16366)
1 parent 4f15759 commit 1104ca1

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/docker.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,15 @@ jobs:
8989
TYPE="-${{ matrix.config.tag }}"
9090
fi
9191
PREFIX="ghcr.io/${REPO_OWNER}/${REPO_NAME}:"
92+
CACHETAGS="${PREFIX}buildcache${TYPE}"
9293
FULLTAGS="${PREFIX}full${TYPE},${PREFIX}full${TYPE}-${{ steps.srctag.outputs.name }}"
9394
LIGHTTAGS="${PREFIX}light${TYPE},${PREFIX}light${TYPE}-${{ steps.srctag.outputs.name }}"
9495
SERVERTAGS="${PREFIX}server${TYPE},${PREFIX}server${TYPE}-${{ steps.srctag.outputs.name }}"
96+
echo "cache_output_tags=$CACHETAGS" >> $GITHUB_OUTPUT
9597
echo "full_output_tags=$FULLTAGS" >> $GITHUB_OUTPUT
9698
echo "light_output_tags=$LIGHTTAGS" >> $GITHUB_OUTPUT
9799
echo "server_output_tags=$SERVERTAGS" >> $GITHUB_OUTPUT
100+
echo "cache_output_tags=$CACHETAGS" # print out for debugging
98101
echo "full_output_tags=$FULLTAGS" # print out for debugging
99102
echo "light_output_tags=$LIGHTTAGS" # print out for debugging
100103
echo "server_output_tags=$SERVERTAGS" # print out for debugging
@@ -131,11 +134,14 @@ jobs:
131134
target: full
132135
provenance: false
133136
# using github experimental cache
134-
cache-from: type=gha
135-
cache-to: type=gha,mode=max
137+
#cache-from: type=gha
138+
#cache-to: type=gha,mode=max
136139
# return to this if the experimental github cache is having issues
137140
#cache-to: type=local,dest=/tmp/.buildx-cache
138141
#cache-from: type=local,src=/tmp/.buildx-cache
142+
# using registry cache (no storage limit)
143+
cache-from: type=registry,ref=${{ steps.tag.outputs.cache_output_tags }}
144+
cache-to: type=registry,ref=${{ steps.tag.outputs.cache_output_tags }},mode=max
139145

140146
- name: Build and push Light Docker image (tagged + versioned)
141147
if: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.config.light == true }}
@@ -150,11 +156,14 @@ jobs:
150156
target: light
151157
provenance: false
152158
# using github experimental cache
153-
cache-from: type=gha
154-
cache-to: type=gha,mode=max
159+
#cache-from: type=gha
160+
#cache-to: type=gha,mode=max
155161
# return to this if the experimental github cache is having issues
156162
#cache-to: type=local,dest=/tmp/.buildx-cache
157163
#cache-from: type=local,src=/tmp/.buildx-cache
164+
# using registry cache (no storage limit)
165+
cache-from: type=registry,ref=${{ steps.tag.outputs.cache_output_tags }}
166+
cache-to: type=registry,ref=${{ steps.tag.outputs.cache_output_tags }},mode=max
158167

159168
- name: Build and push Server Docker image (tagged + versioned)
160169
if: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.config.server == true }}
@@ -169,11 +178,14 @@ jobs:
169178
target: server
170179
provenance: false
171180
# using github experimental cache
172-
cache-from: type=gha
173-
cache-to: type=gha,mode=max
181+
#cache-from: type=gha
182+
#cache-to: type=gha,mode=max
174183
# return to this if the experimental github cache is having issues
175184
#cache-to: type=local,dest=/tmp/.buildx-cache
176185
#cache-from: type=local,src=/tmp/.buildx-cache
186+
# using registry cache (no storage limit)
187+
cache-from: type=registry,ref=${{ steps.tag.outputs.cache_output_tags }}
188+
cache-to: type=registry,ref=${{ steps.tag.outputs.cache_output_tags }},mode=max
177189

178190
create_tag:
179191
name: Create and push git tag

0 commit comments

Comments
 (0)