FROM rust:stretch as build

ARG STACKS_NODE_VERSION="No Version Info"
ARG GIT_BRANCH='No Branch Info'
ARG GIT_COMMIT='No Commit Info'

WORKDIR /src

COPY . .

RUN apt-get update && apt-get install -y git

RUN rustup target add x86_64-unknown-linux-gnu

RUN cargo build --release --workspace --target x86_64-unknown-linux-gnu

RUN mkdir /out && cp -R /src/target/x86_64-unknown-linux-gnu/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /