-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerfile: allow pivot point for --parents flag #4728
Conversation
Signed-off-by: Tonis Tiigi <[email protected]>
This replicates similar functionality in rsync. Signed-off-by: Tonis Tiigi <[email protected]>
As with Rsync, it is possible to limit which parent directories are preserved by | ||
inserting a dot and a slash (`./`) into the source path. If such point exists, only parent | ||
directories after it will be preserved. This may be especially useful copies between stages | ||
with `--from` where the source paths need to be absolute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dockerfile version should be mentioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 1578
parent, pattern, ok := strings.Cut(src, "/./") | ||
if !ok { | ||
pattern = src | ||
src = "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.PathSeparator should be used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it should always be slash. Windows works with slashes as well. If the input is not /
( and windows) then it is converted to /
in NormalizePath()
.
That was fast. You rock! Thank you! 🙏🏻 |
Signed-off-by: Tonis Tiigi <[email protected]>
2c9aba0
to
d1446a4
Compare
follow-up for #3001
Similarily to
rsync
--relative
flag add support for/./
pivot point to mark which parent directories as kept.This is especially useful in multi-stage builds because
--from
paths need to be always full paths.cc @DYefimov