moby / buildkit

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
https://github.com/moby/moby/issues/34227
Apache License 2.0
7.85k stars 1.09k forks source link

add an additional --exclude option to COPY instruction for the files or folders to be excluded while copying them #2853

Open developer-guy opened 2 years ago

developer-guy commented 2 years ago

AFAIK, COPY instruction already has support some basic level of regexp to exclude files or folders, but, with this option, we'd enhance this functionality. To be more precise, I'd recommended adding an additional --exclude option to docker/dockerfile frontend to let people specify which files or folders to be excluded while copying them:

COPY --exclude=*.sh,type=file # will exclude files ends with .sh
COPY --exclude=manifests,type=folder # will exclude manifests folder

would it make sense? @crazy-max @dentrax

thaJeztah commented 1 year ago

Related topics;

leandrosansilva commented 7 months ago

An attempt to implement this feature (without support of the type flag) can be found at https://github.com/moby/buildkit/pull/4561.