Skip to content

COPY with excluded files is not possible #15771

@bronger

Description

@bronger

I need to COPY a part of a context directory to the container (the other part is subject to another COPY). Unfortunately, the current possibilities for this are suboptimal:

  1. COPY and prune. I could remove the unwanted material after an unlimited COPY. The problem is that the unwanted material may have changed, so the cache is invalidated.
  2. COPY every file in a COPY instruction of it own. This adds a lot of unnecessary layers to the image.
  3. Writing a wrapper around the "docker build" call that prepares the context in some way so that the Dockerfile can comfortably copy the wanted material. Cumbersome and difficult to maintain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/builderBuildkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.kind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions