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
Builder - Add zip support to ADD #32745
Comments
|
I think this is a dupe of #15036 As mentioned in that issue, |
|
I'm not married to ADD as the keyword but the scenario is pretty valuable. |
|
@taylorb-microsoft the problem is that you typically don't want exactly what's in a .zip. Instead, you want the zip, do some transformation on the contents (eg. compile source code), and then get rid of anything from the zip you don't need. To keep image-size minimal, you want to do that in a single layer. Here's an example: https://github.com/docker-library/golang/blob/master/1.8/windows/windowsservercore/Dockerfile#L15 Details here: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#add-or-copy Do you have a specific use-case in mind? |
|
|
|
Thanks, we are looking at bringing better compression tools support into Windows but it does seem like being able to accomplish these operations without starting a container might be beneficial. |
|
@taylorb-microsoft Perhaps this is something to discuss to come up with a new instruction for the Dockerfile. It really is a bad idea to overload There's no reason why such functionality couldn't be added using a different new instruction ( |
|
But how do you integrate ZIP files then? AFAIK, the COPY instruction will create an image layer you do not need afterwards in most cases for this scenario. This is a waste of space which will become noticable for large archives. https://devops.stackexchange.com/questions/3172/copy-and-zip-files-in-dockerfile |
|
Automatic extraction (with If you're adding a remote archive; use a multi stage build, and decompress in an intermediate build-stage |
I need to be able to build under Windows and the NTFS filesystem mapping may not preserve the original metadata exactly, hence I would like to unpack an archive instead. |
Many windows components are available as .zip files (for example .net core, PowerShell etc...) because ADD does not support unpacking of those files code execution in the container is required creating additional unneeded layers.
Linux Example w/tar
FROM alpine
ADD foo.tar.gz /bar/
Result
foo is unpacked under the new bar directory
Windows Example w/tar
FROM microsoft/nanoserver
ADD foo.tar.gz /bar/
Result
foo is unpacked under the new bar directory
Windows Example w/zip
FROM microsoft/nanoserver
ADD foo.zip /bar/
Result
foo.zip is copied to the /bar directory i.e. bar/foo.zip :(
The text was updated successfully, but these errors were encountered: