2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 19:31:35 +00:00
pict-rs/docker/dev/Dockerfile.arm32v7

61 lines
1.4 KiB
Text

# Basic cross-build environment
FROM rustembedded/cross:armv7-unknown-linux-musleabihf as cross-build
ARG UID=1000
ARG GID=1000
ENV \
ARCH=armhf \
HOST=arm-unknown-linux \
TOOLCHAIN=stable \
TARGET=armv7-unknown-linux-musleabihf \
BUILD_MODE=release \
DEBIAN_FRONTEND=noninteractive
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 \
build
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 \
PATH=$PATH:/opt/build/.cargo/bin
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