Closed etolbakov closed 1 year ago
Partially addressed in https://github.com/etolbakov/excalidocker-rs/pull/11 (reduced size to 77.79 MB) but maybe it can be done even better
There were a couple of experiments done.
cross
has been used to produce cross-platform artefact.
FROM scratch
was working but due to the command line parameters (sh
) I had to give up that idea
CMD ["sh", "-c", "excalidocker --input-path ${INPUT_PATH} ${SKIP_DEPS:+ --skip-dependencies} --config-path ${CONFIG_PATH:-/excalidocker/bin/excalidocker-config.yaml}"]
The reason here is that, FROM scratch
is an empty, zero-byte image / filesystem, where you add everything yourself.
Probably it makes sense to look closer at:
https://gist.github.com/thaJeztah/cfd929a31976b745e3f7515ae37eb192#silly-experiment-with-mounting-utilities-into-scratch
FROM FROM alpine:3.18.2
has sh
so it was the choice. This approach allowed the image size to be 18.2 MB. Still a bit of overhead but at this point in time I'm fine with the result.
Alpine has only /bin/sh
, to add bash
- apk add bash
take from here.
The change exists in the https://github.com/etolbakov/excalidocker-rs/pull/30 pr; The artefact - etolbakov/excalidocker:0.1.7-prerelease-20230630
Useful links: [1] https://bxbrenden.github.io/ [2] https://zawadidone.nl/using-docker-images-from-scratch/ nginx with scratch. Potentially could be taken as an example [3] good old posts from jpetazzo: 1 and 2 [4] https://vsupalov.com/docker-shared-permissions/ - permissions of the file that is executed as entrypoint
This is the example that was taken: https://github.com/planktonlabs/frozenkrill/blob/1435ab867cc1b595605924346ebc05450a481160/.github/workflows/tag.yml
https://github.com/taoky/libbinder/blob/da9d92fd0ce889d3229ee734522675ba1d2704e7/.github/workflows/rust.yml https://github.com/Tencent/tat-agent/blob/86e11c4e90d22e53c435c49173f5a143e2993e49/Makefile
https://github.com/obelisk/rustica/blob/c20139e02b887655537f94d30b6f24841ee983d1/docker/Dockerfile_influx.amd64#L4 https://github.com/lostintime/aws-s3-webdav/blob/c7daea24449bee5c806340131dec86d5d42af221/Dockerfile-alpine#L4 https://github.com/L1nkZ/rpatchur/blob/21a548277189fecf1c24f61565337158c4ab19a9/docker/Dockerfile-musl https://github.com/ViViDboarder/vaultwarden_ldap/blob/e80dce804297e80f1b3e621f530dbf76c16a8a20/Dockerfile.alpine#L4 https://github.com/earthly/earthly/blob/05e2b4488c22326de46020446915115164751142/README.md https://github.com/emk/rust-musl-builder https://github.com/tarrall/chaosmarmoset/blob/3e53563f1175d3903187bbcb81e4007033a88cfc/Dockerfile
https://github.com/tylerhjones/rust-graphql-docker/blob/cdac983e8918883197c5581634fc52c944a6824f/api/Dockerfile#L33 https://github.com/aws/jsii/blob/26724cde5b7446264224b17c4e6e44291739534f/superchain/Dockerfile#L23 https://github.com/Gelbpunkt/queque/blob/12c016c16abc3b717a78c13ccfa3fe0f58c5a6c6/Dockerfile#L2 https://github.com/IgnisDa/ryot/blob/1ff82460b5a0fa628ebeec96da98b0d7366df576/Dockerfile#L29 https://github.com/cpretzer/linkerd2/blob/df9b09b154eceeabb7bc85aa49b45a10e867e460/policy-controller/Dockerfile#L2 https://github.com/fission-codes/rust-template/blob/0895d0a329136867f445e7dc10719f2b666a993c/examples/gen-axum/Dockerfile#L7 https://github.com/richardnfag/fluor/blob/896bcd77856c01019a2c9327bdfd63baaa718972/templates/rust.dockerfile#L2 https://github.com/fmeringdal/nettu-scheduler/blob/4bcfb3e391112413fd4c80098910bbd26ae2bd7e/scheduler/musl.Dockerfile#L20 https://github.com/wilt00/lgtm/blob/060bd19ba59092f8c86b7431401e95e826b28c96/docker/cli.Dockerfile#L2
At the moment
etolbakov/excalidocker
image is 115.55 Mb. Image size optimizations are required.