forked from satackey/action-docker-layer-caching
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README from Mendhak/main (#6)
* Run Prettier, update deprecation notice * Hyperlink to push-prebuilt-action
- Loading branch information
Showing
1 changed file
with
36 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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 | ||
|
@@ -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. | ||
|
@@ -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.) |