Skip to content
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

Add --parents option for COPY in Dockerfiles #5557

Open
uckelman opened this issue May 31, 2024 · 13 comments · May be fixed by #6008
Open

Add --parents option for COPY in Dockerfiles #5557

uckelman opened this issue May 31, 2024 · 13 comments · May be fixed by #6008

Comments

@uckelman
Copy link

Description

Docker added a --parents option to the Dockerfile COPY command last year:

moby/moby#35639
moby/buildkit#3001
https://docs.docker.com/reference/dockerfile/#copy---parents

buildah doesn't know how to handle COPY --parents so errors out on Dockerfiles which use it.

I'm seeing increasing use of --parents in Dockerfiles I have to deal with, which is making it hard to use podman/buildah instead of Docker. --parents is also a genuinely useful option on its own, so would be nice to have not just for compatibility.

It's quite useful to be able to do things like

COPY --parents src/**/pyproject.toml src/**/poetry.lock /app/

and maintain the directory structure in the destination without having to list out every single file.

@TomSweeneyRedHat
Copy link
Member

I believe @mheon is either working on this or looking into this. Matt?

@mheon
Copy link
Member

mheon commented Jun 5, 2024

Yep, hoping to get to this over the next few weeks

Copy link

github-actions bot commented Jul 6, 2024

A friendly reminder that this issue had no activity for 30 days.

@cyqsimon
Copy link

This is so badly needed with Java projects that involve multiple pom.xml files. Any progress on this?

@krmao
Copy link

krmao commented Oct 10, 2024

any more update?

@jorlando-elucid
Copy link

bump this is a good idea

@Peneheals
Copy link

any news? :)

@rhatdan
Copy link
Member

rhatdan commented Jan 6, 2025

Could you give me a sample Containerfile that would use this?

@cyqsimon
Copy link

cyqsimon commented Jan 7, 2025

@rhatdan Of course. This sort of thing is useful in a workspace of any language where nested manifest files are involved.

Here is an example in Rust (they are working on toolchain support for building only dependencies without project source, but that's not our concern).

Alternatively, here is an example with Maven (which has existing toolchain support). To optimise layer caching, you would want something like this:

COPY --parents **/pom.xml ./
RUN mvn dependency:go-offline

Without --parents, you'd have to manually path to every sub-manifest.

@oliversalzburg
Copy link

https://github.com/larixer/docker-js-monorepo has some pretty good examples as well.

rhatdan added a commit to rhatdan/buildah that referenced this issue Jan 7, 2025
@kikorb
Copy link

kikorb commented Jan 31, 2025

Any news on this? it would be really helpful to have --parents supported

@mheon
Copy link
Member

mheon commented Jan 31, 2025

@Honny1 might have time to work on this?

@Honny1
Copy link
Member

Honny1 commented Feb 5, 2025

I will take a look.

Honny1 added a commit to Honny1/buildah that referenced this issue Feb 25, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
@Honny1 Honny1 linked a pull request Feb 25, 2025 that will close this issue
Honny1 added a commit to Honny1/buildah that referenced this issue Feb 25, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
Honny1 added a commit to Honny1/buildah that referenced this issue Feb 25, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
Honny1 added a commit to Honny1/buildah that referenced this issue Feb 27, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
Honny1 added a commit to Honny1/buildah that referenced this issue Feb 27, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
Honny1 added a commit to Honny1/buildah that referenced this issue Feb 27, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
Honny1 added a commit to Honny1/buildah that referenced this issue Feb 28, 2025
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: containers#5557

Signed-off-by: Jan Rodák <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.