### 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!