Hey
I’d like to re-use a base image in later build steps.
Let’s suppose we build some base image…
kind: pipeline
type: docker
name: build
steps:
- name: build-base
image: plugins/docker
settings:
repo: my.repo.com/images/base
registry: my.repo.com
dockerfile: ./build/base.Dockerfile
auto_tag: true
…and then we build some more images based upon the previous one:
- name: build-A
image: plugins/docker
settings:
repo: my.repo.com/images/a
registry: my.repo.com
dockerfile: ./build/a.Dockerfile
auto_tag: true
- name: build-B
image: plugins/docker
settings:
repo: my.repo.com/images/b
registry: my.repo.com
dockerfile: ./build/b.Dockerfile
auto_tag: true
So both, a.Dockerfile
and b.Dockerfile
, start with:
FROM my.repo.com/images/base
Currently, both build steps, build-A
and build-B
, re-pull base
image from my.repo.com
, resulting in loads of unnecessary traffic and time spent.
How can I get build-A
and build-B
to use a local cache of base
image? It was built in the very same pipeline, so subsequent steps should not re-pull each time (image we have 20 of such images that use the same base -> would re-pull base
20 times).