Skip to content

feature request: more control over the docker build context #2110

@majelbstoat

Description

@majelbstoat

I have a monorepo with shared code. Because docker doesn't follow symlinks and never will, I have to copy that shared code into the right place before building the image for each service. There's currently no facility for doing that with skaffold. I'm using VSCode's Cloud Code extension, so running a wrapper script isn't straightforward, but in any case, I'd like the build to be fully described in the definition, not be dependent on some external glue.

#1441 describes one approach to solving this, which would be great, but I don't need the full flexibility of a custom script.

What I'd like to see is the ability to control which parts of the context are put into the tarball that is sent to Docker. Being able to specify paths, and mappings would be sufficient for my use-case. For example:

context:
  root: .
  paths:
    - mapRef:
        from: services/mercury/src
        to: .
    - mapRef:
        from: shared/nodejs/src
        to: ./lib

This would create a tarball that had files from mercury at the root, and files from the shared source at ./lib. Ideally, it would do this without actually copying the shared files into the mercury service in the local file system.

The absence of the path key would cause behaviour as currently is, i.e. everything beneath the context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildhelp wantedWe would love to have this done, but don't have the bandwidth, need help from contributorskind/feature-requestneeds-design-proposalplatform/monorepomonorepo specific issuespriority/p3agreed that this would be good to have, but no one is available at the moment.

    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