Skip to content

Commit

Permalink
Update README from Mendhak/main (#6)
Browse files Browse the repository at this point in the history
* Run Prettier, update deprecation notice

* Hyperlink to push-prebuilt-action
  • Loading branch information
jpribyl authored Nov 25, 2022
1 parent e345094 commit f262ef8
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ You can run `docker build` and `docker-compose build` in your GitHub Actions wor

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.

## ⚠️ **Deprecation Notice for `v0.0.4` and older** ⚠️
## ⚠️ **Deprecation Notice for `satackey v0.0.11` and older** ⚠️

The author had not considered a large number of layers to be cached, so those versions process all layers in parallel.
([#12](https://github.com/satackey/action-docker-layer-caching/issues/12))
**Please update to version `v0.0.5` with limited concurrency to avoid overloading the cache service.**
Both this and the underlying [push-prebuilt-action](https://github.com/jpribyl/push-prebuilt-action) repositories seem to be
abandoned and the old repo is throwing a couple deprecation warnings. v0.1.0
addresses those. Would be happy to add others on as maintainers as well to
avoid a repeat of this scenario.

([#347](https://github.com/satackey/action-docker-layer-caching/issues/347))
\*\*Please update to version `v0.1.0`

## Example workflows

### Docker Compose

```yaml
name: CI

Expand All @@ -26,26 +31,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

# Pull the latest image to build, and avoid caching pull-only images.
# (docker pull is faster than caching in most cases.)
- run: docker-compose pull
# Pull the latest image to build, and avoid caching pull-only images.
# (docker pull is faster than caching in most cases.)
- run: docker-compose pull

# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: jpribyl/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: jpribyl/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

- run: docker-compose up --build
- run: docker-compose up --build

# Finally, "Post Run jpribyl/[email protected]",
# which is the process of saving the cache, will be executed.
```


### docker build

```yaml
Expand All @@ -58,23 +62,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: jpribyl/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: jpribyl/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

# Finally, "Post Run jpribyl/[email protected]",
# which is the process of saving the cache, will be executed.
```


## Inputs

See [action.yml](./action.yml) for details.
Expand All @@ -83,13 +86,13 @@ By default, the cache is separated by the workflow name.
You can also set the cache key manually, like the official [actions/cache](https://github.com/actions/cache#usage) action.

```yaml
- uses: jpribyl/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
with:
key: foo-docker-cache-{hash}
restore-keys: |
foo-docker-cache-
- uses: jpribyl/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
with:
key: foo-docker-cache-{hash}
restore-keys: |
foo-docker-cache-
```
**Note: You must include `{hash}` in the `key` input.** (`{hash}` is replaced by the hash value of the docker image when the action is executed.)

0 comments on commit f262ef8

Please sign in to comment.