运维123 - mcporter
type: channel
link: https://www.sddts.cn/index.php/category/mcporter/
description: mcporter
items: Docker 跨平台构建 mcporter 二进制文件

Docker 跨平台构建 mcporter 二进制文件
type: item
date: 2026-03-02T15:35:22+00:00
description: 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 linki…