2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-10 06:25:00 +00:00
pict-rs/docker/dev/Dockerfile.amd64

61 lines
1.4 KiB
Text

# Basic cross-build environment
FROM rustembedded/cross:x86_64-unknown-linux-musl as cross-build
ARG UID=1000
ARG GID=1000
ENV \
ARCH=amd64 \
HOST=x86_64-unknown-linux \
TOOLCHAIN=stable \
TARGET=x86_64-unknown-linux-musl \
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