Files
wehub-resource-sync cb15c5e0d8
CI / Rust (windows-latest - x86_64-pc-windows-msvc) (push) Waiting to run
CI / Native E2E Tests (push) Blocked by required conditions
CI / Windows Integration Test (push) Blocked by required conditions
CI / Version Sync Check (push) Waiting to run
CI / Rust (push) Waiting to run
CI / Dashboard (push) Waiting to run
CI / Sandbox Package (push) Waiting to run
CI / Rust (macos-latest - aarch64-apple-darwin) (push) Waiting to run
CI / Rust (macos-latest - x86_64-apple-darwin) (push) Waiting to run
CI / Global Install (macos-latest) (push) Blocked by required conditions
CI / Global Install (ubuntu-latest) (push) Blocked by required conditions
CI / Global Install (windows-latest) (push) Blocked by required conditions
Release / Check for new version (push) Waiting to run
Release / Build macOS ARM64 (push) Blocked by required conditions
Release / Build macOS x64 (push) Blocked by required conditions
Release / Build Linux ARM64 (push) Blocked by required conditions
Release / Build Linux musl ARM64 (push) Blocked by required conditions
Release / Build Linux musl x64 (push) Blocked by required conditions
Release / Build Linux x64 (push) Blocked by required conditions
Release / Build Windows x64 (push) Blocked by required conditions
Release / Publish to npm (push) Blocked by required conditions
Release / Publish sandbox package to npm (push) Blocked by required conditions
Release / Create GitHub Release (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 12:35:58 +08:00

164 lines
4.8 KiB
YAML

# Docker Compose for building agent-browser
# Usage: docker compose -f docker/docker-compose.yml run build-linux
# docker compose -f docker/docker-compose.yml run build-windows
#
# Note: macOS builds should be done natively on macOS for compatibility.
services:
# Build for Linux platforms
build-linux:
platform: linux/amd64
build:
context: ..
dockerfile: docker/Dockerfile.build
volumes:
- ../cli:/build
- ../bin:/output
command: |
-c '
set -euo pipefail
echo "Building for Linux platforms..."
rm -f /output/agent-browser-linux-x64 /output/agent-browser-linux-arm64
echo "→ Linux x64"
cargo zigbuild --release --target x86_64-unknown-linux-gnu.2.28
cp /build/target/x86_64-unknown-linux-gnu/release/agent-browser /output/agent-browser-linux-x64
chmod +x /output/agent-browser-linux-x64
echo "✓ Linux x64 done"
echo "→ Linux ARM64"
cargo zigbuild --release --target aarch64-unknown-linux-gnu.2.28
cp /build/target/aarch64-unknown-linux-gnu/release/agent-browser /output/agent-browser-linux-arm64
chmod +x /output/agent-browser-linux-arm64
echo "✓ Linux ARM64 done"
echo ""
echo "✓ Linux platforms built successfully!"
ls -la /output/agent-browser-linux-*
'
# Build for Windows
build-windows:
platform: linux/amd64
build:
context: ..
dockerfile: docker/Dockerfile.build
volumes:
- ../cli:/build
- ../bin:/output
command: |
-c '
set -euo pipefail
echo "Building for Windows x64..."
rm -f /output/agent-browser-win32-x64.exe
cargo build --release --target x86_64-pc-windows-gnu
cp /build/target/x86_64-pc-windows-gnu/release/agent-browser.exe /output/agent-browser-win32-x64.exe
echo ""
echo "✓ Windows build completed!"
ls -la /output/agent-browser-win32-*
'
# Build for a single target
build-single:
platform: linux/amd64
build:
context: ..
dockerfile: docker/Dockerfile.build
volumes:
- ../cli:/build
- ../bin:/output
environment:
- TARGET=${TARGET:-}
- RUST_TARGET=${RUST_TARGET:-}
- BUILD_TARGET=${BUILD_TARGET:-}
- OUTPUT_NAME=${OUTPUT_NAME:-agent-browser-linux-x64}
command: |
-c '
set -euo pipefail
rust_target="$${RUST_TARGET:-}"
build_target="$${BUILD_TARGET:-}"
legacy_target="$${TARGET:-}"
normalize_rust_target() {
case "$$1" in
x86_64-unknown-linux-gnu.*)
printf "%s\n" "x86_64-unknown-linux-gnu"
;;
aarch64-unknown-linux-gnu.*)
printf "%s\n" "aarch64-unknown-linux-gnu"
;;
*)
printf "%s\n" "$$1"
;;
esac
}
derive_build_target() {
case "$$1" in
x86_64-unknown-linux-gnu.*|aarch64-unknown-linux-gnu.*)
printf "%s\n" "$$1"
;;
x86_64-unknown-linux-gnu|aarch64-unknown-linux-gnu)
printf "%s.2.28\n" "$$1"
;;
*)
printf "%s\n" "$$1"
;;
esac
}
if [ -n "$$rust_target" ]; then
rust_target="$$(normalize_rust_target "$$rust_target")"
fi
if [ -n "$$legacy_target" ]; then
if [ -z "$$rust_target" ]; then
rust_target="$$(normalize_rust_target "$$legacy_target")"
fi
if [ -z "$$build_target" ]; then
build_target="$$(derive_build_target "$$legacy_target")"
fi
fi
if [ -z "$$rust_target" ] && [ -n "$$build_target" ]; then
rust_target="$$(normalize_rust_target "$$build_target")"
fi
if [ -z "$$build_target" ] && [ -n "$$rust_target" ]; then
build_target="$$(derive_build_target "$$rust_target")"
fi
if [ -z "$$rust_target" ]; then
rust_target="x86_64-unknown-linux-gnu"
fi
if [ -z "$$build_target" ]; then
build_target="$$(derive_build_target "$$rust_target")"
fi
expected_rust_target="$$(normalize_rust_target "$$build_target")"
if [ "$$expected_rust_target" != "$$rust_target" ]; then
echo "ERROR: BUILD_TARGET ($$build_target) maps to $$expected_rust_target, but RUST_TARGET is $$rust_target"
exit 1
fi
rm -f /output/$$OUTPUT_NAME
cargo zigbuild --release --target "$$build_target"
source_path=/build/target/$$rust_target/release/agent-browser
if [ -f "$$source_path.exe" ]; then
source_path="$$source_path.exe"
fi
cp "$$source_path" /output/$$OUTPUT_NAME
chmod +x /output/$$OUTPUT_NAME 2>/dev/null || true
echo "✓ Built $$OUTPUT_NAME"
'