feature request: more control over the docker build context
#2,110 opened on May 10, 2019
Description
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.