aiodocker icon indicating copy to clipboard operation
aiodocker copied to clipboard

Add `mktar_from_directory` util

Open phlax opened this issue 3 years ago • 10 comments

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 avatar Jul 17 '21 08:07 phlax

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

asvetlov avatar Jul 21 '21 08:07 asvetlov

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

q0w avatar Nov 09 '21 15:11 q0w

Sorry, I cannot find mktar_from_tar function in the project.

asvetlov avatar Nov 11 '21 08:11 asvetlov

Sorry, mb - mktar_from_dockerfile

q0w avatar Nov 11 '21 09:11 q0w

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

asvetlov avatar Nov 12 '21 11:11 asvetlov

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

phlax avatar Nov 12 '21 12:11 phlax

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

q0w avatar Nov 12 '21 15:11 q0w

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

phlax avatar Nov 12 '21 15:11 phlax

they also cribbed it from moby

q0w avatar Nov 12 '21 15:11 q0w