-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to cross compile using docker
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sudo rm -rf ./build | ||
docker build -t doryani-build -f cc.Dockerfile . | ||
docker run -v ./build:/build doryani-build | ||
|
||
echo "Finished building!" | ||
|
||
ls -al build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM rust:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN apt update && \ | ||
apt upgrade -y && \ | ||
apt install -y g++ g++-mingw-w64-x86-64 zip && \ | ||
rustup target add x86_64-unknown-linux-gnu && \ | ||
rustup target add x86_64-pc-windows-gnu && \ | ||
rustup toolchain install stable-x86_64-unknown-linux-gnu && \ | ||
rustup toolchain install stable-x86_64-pc-windows-gnu | ||
|
||
RUN cargo build --release --target x86_64-unknown-linux-gnu && \ | ||
cargo build --release --target x86_64-pc-windows-gnu && \ | ||
mkdir /app/builds && \ | ||
tar -czvf /app/builds/doryani-linux-x86_64.tar.gz /app/target/x86_64-unknown-linux-gnu/release/doryani && \ | ||
zip -r /app/builds/doryani-windows-x86_64.zip /app/target/x86_64-pc-windows-gnu/release/doryani.exe && \ | ||
ls -al /app/builds | ||
|
||
WORKDIR /build | ||
|
||
CMD ["/bin/sh", "-c", "mv /app/builds/doryani-linux-x86_64.tar.gz /build/; mv /app/builds/doryani-windows-x86_64.zip /build/"] |