File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -19,21 +19,31 @@ jobs:
19
19
uses : actions/cache@v4
20
20
with :
21
21
path : cache-image.tar
22
- key : docker-image-${{ runner.os }}-${{ github.run_id }}
22
+ key : docker-image-${{ runner.os }}-${{ github.sha }}
23
23
restore-keys : |
24
24
docker-image-${{ runner.os }}-
25
25
26
26
- name : Load Cached Image
27
27
shell : pwsh
28
- if : success() && hashFiles('cache-image.tar') != ''
28
+ id : load_cache
29
29
run : |
30
- docker load -i cache-image.tar
30
+ if (Test-Path cache-image.tar) {
31
+ docker load -i cache-image.tar
32
+ echo "CACHE_HIT=true" >> $env:GITHUB_ENV
33
+ }
31
34
32
- - name : Build Image
35
+ - name : Build Image Without Cache
36
+ if : env.CACHE_HIT != 'true'
33
37
shell : pwsh
34
38
run : |
35
39
docker build -f docker/mount.dockerfile -t app:latest .
36
40
41
+ - name : Build Image With Cache
42
+ if : env.CACHE_HIT == 'true'
43
+ shell : pwsh
44
+ run : |
45
+ docker build --cache-from app:latest -f docker/mount.dockerfile -t app:latest .
46
+
37
47
- name : Save Docker Image to TAR
38
48
shell : pwsh
39
49
run : |
43
53
uses : actions/cache@v4
44
54
with :
45
55
path : cache-image.tar
46
- key : docker-image-${{ runner.os }}-${{ github.run_id }}
56
+ key : docker-image-${{ runner.os }}-${{ github.sha }}
47
57
restore-keys : |
48
58
docker-image-${{ runner.os }}-
You can’t perform that action at this time.
0 commit comments