Feature proposal: Build Docker images with 0install
"Bastian Eicher" <[email protected]> Thu, 21 Nov 2019 15:17:23 +0100
| Newsgroups | gmane.comp.file-systems.zero-install.devel |
|---|---|
| Message-ID | <[email protected]> |
I would like to propose a small addition to 0install that I believe would work great with Docker multi-stage builds (https://docs.docker.com/develop/develop-images/multistage-build/). A new command-line options for the "0install run" command, called something like --print-script: Everything runs as usual (select, download, etc.) right up until the point where the target application would be executed. Now instead an equivalent shell script is printed to stdout. Basically this would mean encoding and printing the output get_exec_args (https://github.com/0install/0install/blob/master/ocaml/zeroinstall/exec.ml# L109) like this: #!/bin/sh VAR1=/root/.cache/0install.net/implementations/sha256_ABC123 /root/.cache/0install.net/implementations/sha256_DEF456/myapp With this feature it would now be possible to use 0install to download an app and its dependencies in Docker but then use that app without having to include 0install in the final image: FROM some-image-with-0install as builder RUN 0install run --print-shell http://example.com/feed.xml > /app RUN chmod +x /app FROM debian COPY --from=builder /root/.cache/0install.net /root/.cache/0install.net COPY --from=builder /app /app ENTRYPOINT ["./app"] Another usecase for this would be sandbox tools. For example: The new Windows Sandbox feature in Windows 10 automatically creates light-weight throw-away VMs for testing untrusted software. Zero Install could resolve and download dependencies outside of the sandbox and then mount the implementation cache directory and a (Windows) shell script into the sandbox VM.