|
1 | 1 | # action-docker-layer-caching [](https://github.com/satackey/action-docker-layer-caching/actions?query=workflow%3A%22Readme+Test%22) [](https://github.com/satackey/action-docker-layer-caching/actions?query=workflow%3ACI) |
2 | 2 |
|
3 | | -Enable Docker Layer Caching by adding only one line. |
| 3 | +Enable Docker Layer Caching by adding a single line in GitHub Actions. |
4 | 4 |
|
5 | | -You can use `docker build` and `docker-compose build` with the cache without any special configuration, |
6 | | -and there is also support for multi-stage builds. |
| 5 | +You can run `docker build` and `docker-compose build` in your GitHub Actions workflow using the cache with no special configuration, and it also supports multi-stage builds. |
7 | 6 |
|
8 | | -This action uses the [docker save](https://docs.docker.com/engine/reference/commandline/save/) / [docker load](https://docs.docker.com/engine/reference/commandline/load/) command and the [@actions/cache](https://www.npmjs.com/package/@actions/cache) library. |
| 7 | +This GitHub Action uses the [docker save](https://docs.docker.com/engine/reference/commandline/save/) / [docker load](https://docs.docker.com/engine/reference/commandline/load/) command and the [@actions/cache](https://www.npmjs.com/package/@actions/cache) library. |
9 | 8 |
|
10 | 9 |
|
11 | 10 | ## Example workflow |
12 | 11 |
|
| 12 | +### Docker Compose |
13 | 13 | ```yaml |
14 | | -name: Readme Test |
15 | | - |
| 14 | +name: CI |
16 | 15 | on: push |
17 | 16 |
|
18 | 17 | jobs: |
|
31 | 30 | # It also restores the cache if it exists. |
32 | 31 | - uses: satackey/action-docker-layer-caching@v0.0 |
33 | 32 |
|
34 | | - - run: docker-compose build |
| 33 | + - run: docker-compose up --build |
| 34 | + |
| 35 | + # Finally, "Post Run satackey/action-docker-layer-caching@v0.0", |
| 36 | + # which is the process of saving the cache, will be executed. |
| 37 | +``` |
| 38 | + |
| 39 | + |
| 40 | +### docker build |
| 41 | + |
| 42 | +```yaml |
| 43 | +name: CI |
| 44 | + |
| 45 | +on: push |
| 46 | + |
| 47 | +jobs: |
| 48 | + build: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v2 |
| 53 | + |
| 54 | + # In this step, this action saves a list of existing images, |
| 55 | + # the cache is created without them in the post run. |
| 56 | + # It also restores the cache if it exists. |
| 57 | + - uses: satackey/action-docker-layer-caching@v0.0 |
| 58 | + |
| 59 | + - name: Build the Docker image |
| 60 | + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) |
35 | 61 |
|
36 | 62 | # Finally, "Post Run satackey/action-docker-layer-caching@v0.0", |
37 | 63 | # which is the process of saving the cache, will be executed. |
|
0 commit comments