2020-10-11 01:27:57 +00:00
|
|
|
# Basic cross-build environment
|
2021-08-29 03:05:49 +00:00
|
|
|
FROM rustembedded/cross:armv7-unknown-linux-musleabihf as cross-build
|
2020-10-11 01:27:57 +00:00
|
|
|
|
|
|
|
ARG UID=1000
|
|
|
|
ARG GID=1000
|
|
|
|
|
|
|
|
ENV \
|
|
|
|
ARCH=armhf \
|
|
|
|
HOST=arm-unknown-linux \
|
|
|
|
TOOLCHAIN=stable \
|
2021-08-29 03:05:49 +00:00
|
|
|
TARGET=armv7-unknown-linux-musleabihf \
|
|
|
|
BUILD_MODE=release \
|
|
|
|
DEBIAN_FRONTEND=noninteractive
|
2020-10-11 01:27:57 +00:00
|
|
|
|
|
|
|
RUN \
|
|
|
|
sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list > /etc/apt/sources.list.d/ports.list && \
|
|
|
|
sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list && \
|
|
|
|
addgroup --gid $GID build && \
|
|
|
|
adduser \
|
|
|
|
--disabled-password \
|
|
|
|
--gecos "" \
|
|
|
|
--ingroup build \
|
|
|
|
--uid $UID \
|
|
|
|
--home /opt/build \
|
2021-08-29 03:05:49 +00:00
|
|
|
build
|
2020-10-11 01:27:57 +00:00
|
|
|
|
|
|
|
WORKDIR /opt/build
|
|
|
|
|
|
|
|
|
|
|
|
# Environment for Rust
|
|
|
|
FROM cross-build as rust
|
|
|
|
|
|
|
|
ENV \
|
|
|
|
PATH=$PATH:/opt/build/.cargo/bin
|
|
|
|
|
|
|
|
ADD --chown=build:build https://sh.rustup.rs /opt/build/rustup.sh
|
|
|
|
|
|
|
|
USER build
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
chmod +x rustup.sh && \
|
|
|
|
./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \
|
|
|
|
rustup target add $TARGET
|
|
|
|
|
|
|
|
|
|
|
|
# Environment for pict-rs
|
|
|
|
FROM cross-build as pict-rs-builder
|
|
|
|
|
|
|
|
ENV \
|
2021-08-29 03:05:49 +00:00
|
|
|
PATH=$PATH:/opt/build/.cargo/bin
|
2020-10-11 01:27:57 +00:00
|
|
|
|
|
|
|
COPY --from=rust --chown=build:build /opt/build/.cargo /opt/build/.cargo
|
|
|
|
COPY --from=rust --chown=build:build /opt/build/.rustup /opt/build/.rustup
|
|
|
|
COPY root/ /
|
|
|
|
|
|
|
|
USER build
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
mkdir -p /opt/build/repo
|
|
|
|
|
|
|
|
WORKDIR /opt/build/repo
|