From fd3e225018569f82a6c44434e0edb040651f94b7 Mon Sep 17 00:00:00 2001 From: Roman Usherenko Date: Sun, 3 Dec 2017 00:03:08 +0200 Subject: [PATCH 1/2] Mention cache-from in the readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 08c8b9b3..86476b15 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,10 @@ A number of times to retry failed docker push. Defaults to 0. This option can also be configured on the agent machine using the environment variable `BUILDKITE_PLUGIN_DOCKER_COMPOSE_PUSH_RETRIES`. +### `cache-from` (optional) + +A list of images to pull caches from in the format `service:index.docker.io/org/repo/image:tag`. Requires docker-compose file version `3.2+`. Currently only one image per service is supported. If there's no image present for a service local docker cache will be used. + ## Developing To run the tests: From 12f55e9b1967078b6286897492435738ecfbe4f5 Mon Sep 17 00:00:00 2001 From: Roman Usherenko Date: Tue, 12 Dec 2017 13:29:31 +0200 Subject: [PATCH 2/2] add cache-from usage example --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 86476b15..e31a21b2 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,25 @@ steps: - app:index.docker.io/org/repo/myapp - app:index.docker.io/org/repo/myapp:latest ``` +## Reusing caches from images +A newly spawned agent won't contain any of the docker caches for the first run which will result in a long build step. To mitigate this you can reuse caches from a previously built image if it was pushed to the repo on a past run + +```yaml +steps: + - name: ":docker Build an image" + plugins: + docker-compose#v1.7.0: + build: app + image-repository: index.docker.io/org/repo + cache-from: app:index.docker.io/org/repo/myapp:latest + - name: ":docker: Push to final repository" + plugins: + docker-compose#v1.7.0: + push: + - app:index.docker.io/org/repo/myapp + - app:index.docker.io/org/repo/myapp:latest +``` ## Configuration