Skip to content

Reference part of multi-stage build #5191

@tomwidmer

Description

@tomwidmer

Currently, when specifying a build in a compose file there's no way (that I know of) to reference a particular target in a multi-stage build.

You might want to do this if you are using compose for running a local development stack. If an early stage of your build pipeline sets up an image that is suitable for live-development purposes (as well as build), but the later stage(s) crunch it down to a minimal production image, so you can't use the Dockerfile for your live-dev image. Currently, you might instead create 2 docker files, which is more complex and worse to manage.

Adding a 'target' yml arg to build would resolve this, as per docker build. e.g.
Dockerfile:

FROM debian AS build-env
...

docker-compose.yml:

myservice:
  build: .
    target: build-env

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions