FROM rust:stretch as build

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

WORKDIR /src

COPY . .

RUN rustup target add x86_64-pc-windows-gnu

RUN apt-get update && apt-get install -y git gcc-mingw-w64-x86-64

RUN CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc \
    CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
    cargo build --release --workspace --target x86_64-pc-windows-gnu
    
RUN mkdir /out && cp -R /src/target/x86_64-pc-windows-gnu/release/. /out

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