Skip to content

Commit c1019f6

Browse files
committed
Update README
1 parent ee35d46 commit c1019f6

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This action be used for "non-reproducible" containers too.
1919
### apt-get GitHub Actions
2020

2121
Dockerfile:
22+
2223
```dockerfile
2324
FROM ubuntu:22.04
2425
ENV DEBIAN_FRONTEND=noninteractive
@@ -32,6 +33,7 @@ RUN \
3233
```
3334

3435
Action:
36+
3537
```yaml
3638
---
3739
name: Build
@@ -50,22 +52,17 @@ jobs:
5052
images: Build
5153

5254
- name: Cache
53-
uses: actions/cache@v3
55+
uses: actions/cache@v4
5456
id: cache
5557
with:
56-
path: |
57-
var-cache-apt
58-
var-lib-apt
59-
key: cache-${{ hashFiles('.github/workflows/test/Dockerfile') }}
58+
path: cache-mount
59+
key: cache-mount-${{ hashFiles('Dockerfile') }}
6060

61-
- name: inject cache into docker
62-
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
61+
- name: Restore Docker cache mounts
62+
uses: reproducible-containers/buildkit-cache-dance@v3
6363
with:
64-
cache-map: |
65-
{
66-
"var-cache-apt": "/var/cache/apt",
67-
"var-lib-apt": "/var/lib/apt"
68-
}
64+
dockerfile: Dockerfile
65+
cache-dir: cache-mount
6966
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
7067

7168
- name: Build and push
@@ -87,11 +84,25 @@ Real-world examples:
8784

8885
## CacheMap Options
8986

90-
Optionally, instead of a single string for the `target`, you can provide an object with additional options that should be passed to `--mount=type=cache` in the values `cache-map` JSON. The `target` path must be present in the object as a property.
87+
If you require more fine grained control you can manually specify a JSON formatted `cache-map`. The keys specify the paths on the Docker builder host to use as the bind source and the string value provides the cache mount `target` within the Docker build:
88+
89+
```yaml
90+
- name: Restore Docker cache mounts
91+
uses: reproducible-containers/buildkit-cache-dance@v3
92+
with:
93+
cache-map: |
94+
{
95+
"var-cache-apt": "/var/cache/apt",
96+
"var-lib-apt": "/var/lib/apt"
97+
}
98+
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
99+
```
100+
101+
Alternatively, you can provide a JSON object with additional options that should be passed to `--mount=type=cache` in the values `cache-map` JSON. The `target` path must be present in the object as a property.
91102

92103
```yaml
93-
- name: inject cache into docker
94-
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
104+
- name: Restore Docker cache mounts
105+
uses: reproducible-containers/buildkit-cache-dance@v3
95106
with:
96107
cache-map: |
97108
{

0 commit comments

Comments
 (0)