Re: Feature proposal: Build Docker images with 0install
Thomas Leonard <[email protected]> Sat, 23 Nov 2019 14:12:35 +0000
| Newsgroups | gmane.comp.file-systems.zero-install.devel |
|---|---|
| Message-ID | <CAG4opy8StBdQcctGAZ9L5Q=6tQhB7rr1Ui_Rj9DaAGoGLv2w=w@mail.gmail.com> |
On Thu, 21 Nov 2019 at 14:17, Bastian Eicher <[email protected]> wrote: > > 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"] This won't quite work, because if the program runs another program, it needs to go via `0install runenv`. > 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. -- talex5 (GitHub/Twitter) http://roscidus.com/blog/ GPG: 5DD5 8D70 899C 454A 966D 6A51 7513 3C8F 94F6 E0CC