Use docker to build binaries

Since I use nix and the target does not work on other linux distros
This commit is contained in:
Keivan-sf
2025-07-27 22:45:10 +03:30
parent 69c2b0c793
commit 841e83f401
4 changed files with 40 additions and 0 deletions

21
docker-build.sh Executable file
View File

@@ -0,0 +1,21 @@
#!env bash
set -e
BIN_NAME="v2parser"
TARGET_TRIPLE="x86_64-unknown-linux-gnu"
HOST_TARGET_DIR="$(pwd)/target/$TARGET_TRIPLE/release"
docker build \
--platform=linux/amd64 \
-t rust-builder-temp \
-f Dockerfile .
container_id=$(docker create rust-builder-temp)
mkdir -p ./target
docker cp "$container_id:/app/target/$TARGET_TRIPLE/release/$BIN_NAME" "./$BIN_NAME"
docker rm "$container_id"
chmod +x "./$BIN_NAME"
echo "✅ Built binary: ./$BIN_NAME"