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 mktar_from_directory util #602

Open
phlax opened this issue Jul 17, 2021 · 10 comments
Open

Add mktar_from_directory util #602

phlax opened this issue Jul 17, 2021 · 10 comments

Comments

@phlax
Copy link
Contributor

phlax commented Jul 17, 2021

Long story short

I have used aiodocker in a couple of projects, the one thing i find myself implementing is a mktar_from_directory function (or similar) to enable building an image with artefacts

my implementaion/s are very similar to the existing mktar_from_directory, im wondering if it would be helpful to PR this addition

How to reproduce

try to build an image that has artefacts

@phlax phlax changed the title Add mktar_from_directory util Add mktar_from_directory util Jul 17, 2021
@asvetlov
Copy link
Member

Looks like a great idea.
Would you prepare a pull request? Tests are required, they should be an easy excercise.

@q0w
Copy link
Contributor

q0w commented Nov 9, 2021

@asvetlov does it mean that existing mktar_from_tar just needs a new arg directory and new line with t.add(directory, arcname='.') ?

@asvetlov
Copy link
Member

Sorry, I cannot find mktar_from_tar function in the project.

@q0w
Copy link
Contributor

q0w commented Nov 11, 2021

Sorry, mb - mktar_from_dockerfile

@asvetlov
Copy link
Member

I think a separate function is needed.
The function should not accept dockerfile argument but a folder (with dockerfile inside usually) to archive.

@phlax
Copy link
Contributor Author

phlax commented Nov 12, 2021

the most simple implementation would be to send the entire directory/context - ideally it would be able to filter according to any .dockerignore function, but not sure how easy that is in terms of parsing/filtering

@q0w
Copy link
Contributor

q0w commented Nov 12, 2021

Maybe use docker-py implementation with PatternMatcher for .dockerignore?

@phlax
Copy link
Contributor Author

phlax commented Nov 12, 2021

sounds like a plan, but im guessing we would want to avoid a dependency, so i guess it would be a matter of cribbing it

@q0w
Copy link
Contributor

q0w commented Nov 12, 2021

they also cribbed it from moby

@achimnol
Copy link
Member

I'd also suggest refactoring mktar_from_dockerfile and mktar_from_directory to be async context managers that closes the generated file automatically and use asynchronous file I/O (streaming).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants