FROM --platform=$BUILDPLATFORM rust:1-slim-bullseye AS build ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc ENV CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc RUN apt-get update && apt-get -y install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf RUN rustup target add armv7-unknown-linux-gnueabihf WORKDIR /simpleshortener COPY . . ENV RUSTFLAGS="--emit=asm" RUN cargo build --target armv7-unknown-linux-gnueabihf --release # our final base FROM debian:bullseye-slim WORKDIR / COPY --from=build /simpleshortener/target/armv7-unknown-linux-gnueabihf/release/simpleshortener . RUN adduser --home /nonexistent --no-create-home --disabled-password simpleshortener USER simpleshortener CMD ["./simpleshortener"]