32 lines
972 B
Plaintext
32 lines
972 B
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
|
|
|
|
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"
|
|
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
|