fixes
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Multi-platform Rust cross-compilation image
|
||||
FROM rust:1.85-bookworm
|
||||
|
||||
# Install cross-compilation toolchains
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc-aarch64-linux-gnu \
|
||||
gcc-x86-64-linux-gnu \
|
||||
libc6-dev-arm64-cross \
|
||||
libc6-dev-amd64-cross \
|
||||
mingw-w64 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Add Rust targets (Unix only - Windows uses Node.js fallback due to Unix socket dependency)
|
||||
RUN rustup target add \
|
||||
x86_64-unknown-linux-gnu \
|
||||
aarch64-unknown-linux-gnu \
|
||||
x86_64-apple-darwin \
|
||||
aarch64-apple-darwin
|
||||
|
||||
# Install cargo-zigbuild for easier cross-compilation (especially macOS)
|
||||
RUN curl -sSL https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz | tar -xJ -C /opt \
|
||||
&& ln -s /opt/zig-linux-x86_64-0.13.0/zig /usr/local/bin/zig
|
||||
RUN cargo install cargo-zigbuild
|
||||
|
||||
# Configure linkers for cross-compilation
|
||||
RUN mkdir -p /.cargo
|
||||
RUN echo '[target.aarch64-unknown-linux-gnu]\nlinker = "aarch64-linux-gnu-gcc"\n\n[target.x86_64-pc-windows-gnu]\nlinker = "x86_64-w64-mingw32-gcc"\n' > /.cargo/config.toml
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
@@ -0,0 +1,68 @@
|
||||
# Docker Compose for building agent-browser
|
||||
# Usage: docker compose -f docker/docker-compose.yml run build-all
|
||||
#
|
||||
# Note: Windows is skipped because the Rust CLI uses Unix sockets.
|
||||
# Windows users will use the Node.js fallback automatically.
|
||||
|
||||
services:
|
||||
# Build for all Unix platforms
|
||||
build-all:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.build
|
||||
volumes:
|
||||
- ../cli:/build
|
||||
- ../bin:/output
|
||||
command: |
|
||||
-c '
|
||||
set -e
|
||||
echo "Building for all platforms..."
|
||||
|
||||
# Linux x64
|
||||
echo "→ Linux x64"
|
||||
cargo zigbuild --release --target x86_64-unknown-linux-gnu
|
||||
cp /build/target/x86_64-unknown-linux-gnu/release/agent-browser /output/agent-browser-linux-x64
|
||||
chmod +x /output/agent-browser-linux-x64
|
||||
|
||||
# Linux ARM64
|
||||
echo "→ Linux ARM64"
|
||||
cargo zigbuild --release --target aarch64-unknown-linux-gnu
|
||||
cp /build/target/aarch64-unknown-linux-gnu/release/agent-browser /output/agent-browser-linux-arm64
|
||||
chmod +x /output/agent-browser-linux-arm64
|
||||
|
||||
# macOS x64
|
||||
echo "→ macOS x64"
|
||||
cargo zigbuild --release --target x86_64-apple-darwin
|
||||
cp /build/target/x86_64-apple-darwin/release/agent-browser /output/agent-browser-darwin-x64
|
||||
chmod +x /output/agent-browser-darwin-x64
|
||||
|
||||
# macOS ARM64
|
||||
echo "→ macOS ARM64"
|
||||
cargo zigbuild --release --target aarch64-apple-darwin
|
||||
cp /build/target/aarch64-apple-darwin/release/agent-browser /output/agent-browser-darwin-arm64
|
||||
chmod +x /output/agent-browser-darwin-arm64
|
||||
|
||||
echo ""
|
||||
echo "✓ All platforms built successfully!"
|
||||
echo "(Windows uses Node.js fallback - Unix sockets not supported)"
|
||||
ls -la /output/agent-browser-*
|
||||
'
|
||||
|
||||
# Build for a single target (override with TARGET env var)
|
||||
build-single:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.build
|
||||
volumes:
|
||||
- ../cli:/build
|
||||
- ../bin:/output
|
||||
environment:
|
||||
- TARGET=${TARGET:-x86_64-unknown-linux-gnu}
|
||||
- OUTPUT_NAME=${OUTPUT_NAME:-agent-browser-linux-x64}
|
||||
command: |
|
||||
-c '
|
||||
cargo zigbuild --release --target $TARGET
|
||||
cp /build/target/$TARGET/release/agent-browser* /output/$OUTPUT_NAME
|
||||
chmod +x /output/$OUTPUT_NAME 2>/dev/null || true
|
||||
echo "✓ Built $OUTPUT_NAME"
|
||||
'
|
||||
Reference in New Issue
Block a user