Created
March 28, 2019 15:19
-
-
Save tonistiigi/9c6a42efe90111b390d5040cbceec43b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM --platform=$BUILDPLATFORM tonistiigi/xx:llvm AS build | |
ARG TARGETPLATFORM | |
WORKDIR /src | |
COPY hello.c . | |
RUN clang -static -o /hello hello.c | |
FROM scratch | |
ARG TARGETPLATFORM | |
ENV WHOAMI=$TARGETPLATFORM | |
COPY --from=build /hello . | |
ENTRYPOINT ["/hello"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
printf("Hello world, I am %s!", getenv("WHOAMI")); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment