54 lines
918 B
Docker
54 lines
918 B
Docker
ARG TARGET=aarch64-unknown-linux-musl
|
|
|
|
# build environment
|
|
FROM rustembedded/cross:$TARGET
|
|
|
|
ARG UID=991
|
|
ARG GID=991
|
|
ARG TARGET=aarch64-unknown-linux-musl
|
|
ARG TOOL=aarch64-linux-musl
|
|
ARG BUILD_MODE=release
|
|
|
|
ENV \
|
|
UID=${UID} \
|
|
GID=${GID} \
|
|
TARGET=${TARGET} \
|
|
TOOL=${TOOL} \
|
|
BUILD_MODE=${BUILD_MODE} \
|
|
TOOLCHAIN=stable
|
|
|
|
RUN \
|
|
addgroup --gid "${GID}" build && \
|
|
adduser \
|
|
--disabled-password \
|
|
--gecos "" \
|
|
--ingroup build \
|
|
--uid "${UID}" \
|
|
--home /opt/build \
|
|
build
|
|
|
|
ADD \
|
|
https://sh.rustup.rs /opt/build/rustup.sh
|
|
|
|
RUN \
|
|
chown -R build:build /opt/build
|
|
|
|
USER build
|
|
WORKDIR /opt/build
|
|
|
|
ENV \
|
|
PATH=/opt/build/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin
|
|
|
|
RUN \
|
|
chmod +x rustup.sh && \
|
|
./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \
|
|
rustup target add $TARGET
|
|
|
|
USER build
|
|
|
|
WORKDIR /opt/build/
|
|
|
|
COPY root/ /
|
|
|
|
CMD /usr/bin/bash
|