Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/satackey/action-docker-layer-caching
[CAUTION] This repository is not actively maintained. / Enable Docker layer caching in your GitHub Actions workflow.
https://github.com/satackey/action-docker-layer-caching
cache cd ci docker docker-build docker-cache docker-compose github-actions
Last synced: 26 days ago
JSON representation
[CAUTION] This repository is not actively maintained. / Enable Docker layer caching in your GitHub Actions workflow.
- Host: GitHub
- URL: https://github.com/satackey/action-docker-layer-caching
- Owner: satackey
- License: mit
- Created: 2020-06-06T13:11:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-30T08:15:59.000Z (over 1 year ago)
- Last Synced: 2024-09-26T00:58:02.298Z (about 1 month ago)
- Topics: cache, cd, ci, docker, docker-build, docker-cache, docker-compose, github-actions
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/docker-layer-caching
- Size: 844 KB
- Stars: 422
- Watchers: 5
- Forks: 55
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - satackey/action-docker-layer-caching - [CAUTION] This repository is not actively maintained. / Enable Docker layer caching in your GitHub Actions workflow. (TypeScript)
README
# Docker Layer Caching in GitHub Actions [![Readme Test status is unavailable](https://github.com/satackey/action-docker-layer-caching/workflows/Readme%20Test/badge.svg)](https://github.com/satackey/action-docker-layer-caching/actions?query=workflow%3A%22Readme+Test%22) [![CI status is unavailable](https://github.com/satackey/action-docker-layer-caching/workflows/CI/badge.svg)](https://github.com/satackey/action-docker-layer-caching/actions?query=workflow%3ACI)
Enable Docker Layer Caching by adding a single line in GitHub Actions.
This GitHub Action speeds up the building of docker images in your GitHub Actions workflow.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.
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** ⚠️
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.**## Example workflows
### Docker Compose
```yaml
name: CIon: push
jobs:
build:
runs-on: ubuntu-lateststeps:
- 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# 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: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true- run: docker-compose up --build
# Finally, "Post Run satackey/[email protected]",
# which is the process of saving the cache, will be executed.
```### docker build
```yaml
name: CIon: push
jobs:
build:
runs-on: ubuntu-lateststeps:
- 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: satackey/[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)# Finally, "Post Run satackey/[email protected]",
# which is the process of saving the cache, will be executed.
```## Inputs
See [action.yml](./action.yml) for details.
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: satackey/[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.)