Merge pull request #337 from igor-alexandrov/feature/cache

Support for Docker multistage build cache
This commit is contained in:
David Heinemeier Hansson
2023-06-20 11:38:46 +02:00
committed by GitHub
12 changed files with 365 additions and 55 deletions

View File

@@ -473,6 +473,37 @@ builder:
context: ".."
```
### Using multistage builder cache
Docker multistage build cache can singlehandedly speed up your builds by a lot. Currently MRSK only supports using the GHA cache or the Registry cache:
```yaml
# Using GHA cache
builder:
cache:
type: gha
# Using Registry cache
builder:
cache:
type: registry
# Using Registry cache with different cache image
builder:
cache:
type: registry
# default image name is <image>-build-cache
image: application-cache-image
# Using Registry cache with additinonal cache-to options
builder:
cache:
type: registry
options: mode=max,image-manifest=true,oci-mediatypes=true
```
For further insights into build cache optimization, check out documentation on Docker's official website: https://docs.docker.com/build/cache/.
### Using build secrets for new images
Some images need a secret passed in during build time, like a GITHUB_TOKEN, to give access to private gem repositories. This can be done by having the secret in ENV, then referencing it in the builder configuration: