2021-05-08 16:52:33 -04:00
|
|
|
FROM rust:latest
|
|
|
|
ENV CARGO_HOME=/deps
|
|
|
|
WORKDIR /work
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu
|
|
|
|
|
|
|
|
deps:
|
|
|
|
COPY ./Cargo.toml ./Cargo.lock .
|
|
|
|
RUN mkdir src && touch src/main.rs
|
|
|
|
RUN cargo fetch
|
|
|
|
SAVE ARTIFACT /deps
|
|
|
|
|
|
|
|
build:
|
|
|
|
ARG TOOLCHAIN
|
|
|
|
RUN rustup target add $TOOLCHAIN
|
|
|
|
SAVE IMAGE docker-wg:5000/rust-builder:$TOOLCHAIN
|
|
|
|
|
|
|
|
COPY +deps/deps /deps
|
|
|
|
COPY ./Cargo.toml ./Cargo.lock .
|
|
|
|
COPY ./src/ ./src/
|
2021-05-12 23:32:37 -04:00
|
|
|
RUN cargo build --release --target "$TOOLCHAIN"
|
|
|
|
RUN strip "target/$TOOLCHAIN/release/rpn_rs"
|
2021-05-08 16:52:33 -04:00
|
|
|
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs
|
|
|
|
|
|
|
|
all:
|
|
|
|
BUILD --build-arg TOOLCHAIN=x86_64-unknown-linux-musl +build
|
|
|
|
BUILD --build-arg TOOLCHAIN=i686-unknown-linux-musl +build
|
|
|
|
# TODO: Cross compile
|
|
|
|
# BUILD --build-arg TOOLCHAIN=aarch64-unknown-linux-musl +build
|
|
|
|
# BUILD --build-arg TOOLCHAIN=arm-unknown-linux-musleabi +build
|
|
|
|
# BUILD --build-arg TOOLCHAIN=armv7-unknown-linux-musleabi +build
|