Skip to content

Instantly share code, notes, and snippets.

@wzhliang
Created June 28, 2020 01:58
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 wzhliang/8b8e9fdf9b35c9146db814f7afcd8e48 to your computer and use it in GitHub Desktop.
Save wzhliang/8b8e9fdf9b35c9146db814f7afcd8e48 to your computer and use it in GitHub Desktop.
FROM --platform=$BUILDPLATFORM debian:10 AS build
RUN apt-get update && \
apt-get install -y curl gcc make
RUN curl -o /cross.sh https://raw.githubusercontent.com/tonistiigi/binfmt/18c3d40ae2e3485e4de5b453e8460d6872b24d6b/binfmt/scripts/cross.sh && chmod +x /cross.sh
RUN curl https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz | tar xz
WORKDIR hello-2.10
ARG TARGETPLATFORM
RUN /cross.sh install gcc | sh
RUN LDFLAGS=-static \
./configure --host $(/cross.sh cross-prefix) && \
make && \
mkdir -p /out && \
mv hello /out
FROM scratch
COPY --from=build /out/hello /hello
ENTRYPOINT ["/hello"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment