summary: 'Cross-platform binary build using Docker for mcporter: builds all platform binaries in an isolated container.'read_when:'Building mcporter binaries for multiple platforms''Need to build without installing Bun locally''Want reproducible, isolated builds'Docker Cross-Platform BuildMCPorter provides a Docker-based build script that creates cross-platform binaries in an isolated container. This ensures consistent build environments and prevents local system pollution.Quick Start# Run the Docker build script ./docker_build.sh # Or use pnpm pnpm build:dockerBuild TargetsPlatformArchitectureTargetOutputLinuxamd64bun-linux-x64mcporter-linux-amd64Linuxarm64bun-linux-aarch64mcporter-linux-arm64macOSamd64bun-darwin-x64mcporter-macos-amd64macOSarm64bun-darwin-aarch64mcporter-macos-arm64Windowsamd64bun-windows-x64mcporter-windows-amd64.exeWindowsarm64bun-windows-aarch64mcporter-windows-arm64.exePrerequisitesDocker installed and runningAccess to Docker Hub (to pull oven/bun:latest image)Write permissions to project directoryOutput DirectoryAll binaries are output to the build/ directory in the project root:build/ ├── mcporter-linux-amd64 ├── mcporter-linux-arm64 ├── mcporter-macos-amd64 ├── mcporter-macos-arm64 ├── mcporter-windows-amd64.exe └── mcporter-windows-arm64.exeDocker ImageThe script uses the official oven/bun:latest image, which includes:Latest Bun runtimeBuild dependencies for all target platformsMinimal Debian base (~200MB)The image is pulled automatically on first run and cached for subsequent builds.Script InternalsThe Docker container performs:Mount the project directory as /workspaceInstall dependencies via bun installBuild each target using bun scripts/build-bun.tsOutput binaries to /workspace/build/ (mapped to host build/)Container is cleaned up automatically (--rm flag) after build completes.VerificationAfter building, verify the output:# Check output files ls -lh build/ # Test Linux binary ./build/mcporter-linux-amd64 --version # Verify static linking (Linux) ldd build/mcporter-linux-amd64 # Should output: "not a dynamic executable"Local vs Docker BuildFeaturebuild.sh (Local)docker_build.sh (Docker)Requires Bun installedYesNoOutput directorydist-bun/build/Build environmentHost systemIsolated containerReproducibilityDepends on hostConsistentStartup costInstantFirst run: pull imageCustomizationTo customize the build:Change Docker image: Edit DOCKER_IMAGE in docker_build.shModify targets: Edit the TARGETS arrayAdd flags: Pass additional arguments to bun scripts/build-bun.tsExample for single-target build:docker run --rm \ -v "$PWD:/workspace" \ -w /workspace \ oven/bun:latest \ bash -c ' bun install bun scripts/build-bun.ts \ --target bun-linux-x64 \ --output build/mcporter-linux-amd64 '