Skip to content

Instantly share code, notes, and snippets.

@obriencj
Last active February 19, 2024 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obriencj/892adabc5c252a953b2fddb699f4b5c4 to your computer and use it in GitHub Desktop.
Save obriencj/892adabc5c252a953b2fddb699f4b5c4 to your computer and use it in GitHub Desktop.
tiny static native container
# This is a simple example representing a statically linked executable
# embedded in the smallest possible container
FROM gcc:latest as BUILD
WORKDIR /build
RUN gcc -x c -static -o hello - <<EOF
#include <stdio.h>
int main(void) { printf("Hello world\\n"); return 0; }
EOF
FROM scratch
COPY --from=BUILD /build/hello /
ENTRYPOINT ["/hello"]
# The end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment