Skip to content

Instantly share code, notes, and snippets.

@tonistiigi
Created March 28, 2019 15:19
Show Gist options
  • Save tonistiigi/9c6a42efe90111b390d5040cbceec43b to your computer and use it in GitHub Desktop.
Save tonistiigi/9c6a42efe90111b390d5040cbceec43b to your computer and use it in GitHub Desktop.
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"]
#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