mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-15 14:47:51 +00:00
Use docker to build binaries
Since I use nix and the target does not work on other linux distros
This commit is contained in:
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
target
|
||||||
|
docker_target
|
||||||
|
.git
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
|
/docker_target
|
||||||
|
v2parser
|
||||||
|
|||||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM rust:slim AS builder
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
pkg-config libssl-dev build-essential curl git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN rustup target add x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build for the target
|
||||||
|
RUN cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
21
docker-build.sh
Executable file
21
docker-build.sh
Executable 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"
|
||||||
Reference in New Issue
Block a user