35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
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 gdb-mingw-w64 gcc-mingw-w64-x86-64
|
|
|
|
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/
|
|
RUN cargo build --release --target "$TOOLCHAIN"
|
|
RUN strip "target/$TOOLCHAIN/release/rpn_rs"
|
|
RUN xz --keep "target/$TOOLCHAIN/release/rpn_rs"
|
|
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs-$TOOLCHAIN
|
|
SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs.xz AS LOCAL target/$TOOLCHAIN/release/rpn_rs-$TOOLCHAIN.xz
|
|
|
|
all:
|
|
BUILD --build-arg TOOLCHAIN=x86_64-unknown-linux-musl +build
|
|
BUILD --build-arg TOOLCHAIN=i686-unknown-linux-musl +build
|
|
# BUILD --build-arg TOOLCHAIN=x86_64-pc-windows-gnu +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
|