Skip to content

inline Dockerfile #298

@ndeloof

Description

@ndeloof

What is the problem you're trying to solve
A common use-case is to customize an existing image with some minor changes. This requires a minimal Dockerfile with only a few lines. It would be nice one can declare such a Dockerfile directly inside compose.yaml, inlined

Describe the solution you'd like

Use yaml multiline literals with the pipe operator
We can introduce a new dedicated attribute:

services:
   demo:
     build:
        dockerfile-content: |
           FROM alpine
           RUN apk --no-cache add curl

we also can introduce a custom notation to declare inline Dockerfile
maybe we can use a custom yaml type !inline to mark such a block

services:
   demo:
     build:
        dockerfile: !inline |
           FROM alpine
           RUN apk --no-cache add curl

Additional context
docker/compose#8077

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions