|
|
|
|
|
by friseurtermin
1883 days ago
|
|
I love blog posts like these: they don't go after real-world problems directly but rather explore what's even possible. paulfurtado in this comment section mentioned UPX[0] as a way to get binaries even smaller. Funnily enough UPX even managed to decrease the size of the asmttpd web server for me: ### build stage ###
FROM ubuntu:18.04 as builder
RUN apt update
RUN apt install -y make yasm as31 nasm binutils git
RUN git clone https://github.com/nemasu/asmttpd.git asmttpd
RUN mv asmttpd/* .
RUN rm -rd asmttpd
RUN make release
# i have the upx binary on my machine in this case
COPY ./upx-3.96-amd64_linux/upx upx
RUN ./upx --brute asmttpd
### run stage ###
FROM scratch
COPY --from=builder /asmttpd /asmttpd
COPY ./index.html /web_root/index.html
CMD ["/asmttpd", "/web_root", "8080"]
With a 4 byte index.html my total image size is now 5.3kB![0]: https://github.com/upx/upx |
|
Thanks for the kind words. I didn't know about UPX.
I should add an update to the end with this trick!