#syntax=docker/dockerfile:1.3-labs # moving files to custom naming pattern allowing to do # easy target arch based copy FROM busybox as bin WORKDIR /build COPY x86_64-unknown-linux-musl/release/rgreeter /build/rgreeter_amd64 COPY aarch64-unknown-linux-musl/release/rgreeter /build/rgreeter_arm64 # Dynamically Linked binary needs runtime dependencies # FROM debian:bullseye-slim # ARG TARGETARCH # RUN apt-get update & rm -rf /var/lib/apt/lists/* # COPY --from=bin /build/rgreeter_$TARGETARCH /usr/bin/rgreeter # CMD [ "/usr/bin/rgreeter" ] # statically linked binary FROM scratch ARG TARGETARCH COPY --from=bin /build/rgreeter_$TARGETARCH /usr/bin/rgreeter ENTRYPOINT [ "/usr/bin/rgreeter" ]