pict-rs/docker/dev/Dockerfile.arm64v8

62 lines
1.4 KiB
Docker
Raw Normal View History

2020-06-16 20:55:24 +00:00
# Basic cross-build environment
2021-08-29 03:05:49 +00:00
FROM rustembedded/cross:aarch64-unknown-linux-musl as cross-build
2020-06-16 20:55:24 +00:00
ARG UID=1000
ARG GID=1000
2020-06-16 20:55:24 +00:00
ENV \
ARCH=arm64 \
HOST=aarch64-unknown-linux \
2020-06-16 20:55:24 +00:00
TOOLCHAIN=stable \
2021-08-29 03:05:49 +00:00
TARGET=aarch64-unknown-linux-musl \
BUILD_MODE=release \
DEBIAN_FRONTEND=noninteractive
2020-06-15 02:41:45 +00:00
RUN \
2020-06-16 20:55:24 +00:00
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 && \
2020-06-15 02:41:45 +00:00
adduser \
--disabled-password \
--gecos "" \
--ingroup build \
--uid $UID \
2020-06-15 02:41:45 +00:00
--home /opt/build \
2021-08-29 03:05:49 +00:00
build
2020-06-15 02:41:45 +00:00
WORKDIR /opt/build
2020-06-16 20:55:24 +00:00
# Environment for Rust
FROM cross-build as rust
2020-06-15 19:20:25 +00:00
2020-06-16 20:55:24 +00:00
ENV \
PATH=$PATH:/opt/build/.cargo/bin
ADD --chown=build:build https://sh.rustup.rs /opt/build/rustup.sh
USER build
2020-06-15 02:41:45 +00:00
2020-06-16 20:55:24 +00:00
RUN \
chmod +x rustup.sh && \
./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \
rustup target add $TARGET
2020-06-15 02:41:45 +00:00
2020-06-16 20:55:24 +00:00
# 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-06-16 20:55:24 +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/ /
2020-06-15 02:41:45 +00:00
USER build
RUN \
mkdir -p /opt/build/repo
2020-06-15 02:41:45 +00:00
2020-06-16 20:55:24 +00:00
WORKDIR /opt/build/repo