From 70a3a1d5d3caa6fdda9084c6c76e9489b8128a32 Mon Sep 17 00:00:00 2001 From: Adrian Lopez Date: Wed, 11 Oct 2017 10:21:22 +0200 Subject: [PATCH] Use multi-stage build to generate the image Use two stages, one to build the binary and copy in the other the compiled binary. --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 341b0a5..61152a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,14 @@ +FROM nathanosman/nasm as builder +ADD hang.asm /hang.asm +RUN nasm -f elf64 hang.asm +RUN ld -s -o hang hang.o + + FROM scratch MAINTAINER Nathan Osman # Add the binary to the container -ADD hang /hang +COPY --from=builder /hang /hang # Set it as the default entrypoint ENTRYPOINT ["/hang"]