docker-compose-buildkite-plugin
docker-compose-buildkite-plugin copied to clipboard
Add support for overriding `target`
Target being: https://docs.docker.com/compose/compose-file/#target
Allowing you to override this using the plugin would make it possible for you to build multiple targets of a service, push each target to a repository, and then pull them down in a cache-from
in order to use caching for multi-stage builds. This is still doable today, but you have to have multiple docker-compose.yml files for each target. Adding target
to the plugin would make it much easier.
:+1: for this feature. We needed to target our "base" step in the multi-stage Dockerfile in order to get the cache-from
actually working in a single-service build.
Using the 'final' target resulted in intermediate layers we needed (to get the caching working) being removed before the push. That caused extra work to be (re)done in later stages of the pipeline.
Please support configuring a target
in a pipeline step.
PS: as a workaround we added a second config
to the pipeline:
version: '3.7'
services:
our-service:
build:
target: base
and then in the pipeline step:
config:
- docker-compose.yml
- docker-compose-target-base.yml
Currently using multi-stage builds and have developers sad that Buildkite's re-doing work, upvoting.
:+1: for this too. I currently have two separate Dockerfiles to help keep my Buildkite pipeline fast by not using multi-stage builds so it can cache as much as possible, and a final "production" Dockerfile that gets built after.
Having the option to specify different targets would help control this all from a single Dockerfile and ensure cache is used as much as possible.
+1
This looks like a valid request to add a way to customize the docker build --target
option. Or are there more nuance to this?