Skip to content

Instantly share code, notes, and snippets.

@st0le
Created July 11, 2022 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save st0le/c6964eb3efdfa043e1df325acb34fa6b to your computer and use it in GitHub Desktop.
Save st0le/c6964eb3efdfa043e1df325acb34fa6b to your computer and use it in GitHub Desktop.
Build Rust projects without installing rust. (use a docker container)
FROM rust:latest
RUN apt update && apt upgrade -y
RUN apt install -y g++-mingw-w64-x86-64
RUN rustup target add x86_64-pc-windows-gnu
RUN rustup toolchain install stable-x86_64-pc-windows-gnu
WORKDIR /app
CMD ["cargo", "build", "--release", "--target", "x86_64-pc-windows-gnu"]
# docker build . -t rust_cross_compile/windows -f Dockerfile.windows
# docker run --rm -ti -v "$($pwd):/app" rust_cross_compile/windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment