All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 30s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 42s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 41s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 54s
Build and Release / release (push) Has been skipped
- 重构配置方式:使用 params.conf 替代命令行参数 - postinst 自动创建配置文件,升级时保护用户配置 - 初始化 llmdoc 文档系统(概述、架构、指南、参考) - 创建 README.md 和配置指南 - 提供完整的配置模板示例 配置文件优势:升级安全、集中管理、易于维护
88 lines
1.8 KiB
Markdown
88 lines
1.8 KiB
Markdown
# 本地构建指南
|
||
|
||
## 准备工作
|
||
|
||
### 系统依赖
|
||
- Docker
|
||
- Docker Buildx
|
||
- Git
|
||
|
||
### 安装 Docker Buildx
|
||
|
||
```bash
|
||
# 启用 QEMU(支持多平台构建)
|
||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||
|
||
# 创建 buildx builder
|
||
docker buildx create --use --name p2pool_builder --driver docker-container
|
||
docker buildx inspect --bootstrap
|
||
```
|
||
|
||
## 构建二进制包
|
||
|
||
### Alpine 构建(推荐)
|
||
|
||
```bash
|
||
# 构建单一架构
|
||
docker buildx build --pull \
|
||
--platform linux/amd64 \
|
||
--build-arg P2POOL_VERSION=v4.9.1 \
|
||
--output type=local,dest=./output \
|
||
-f docker/Dockerfile.alpine .
|
||
|
||
# 多架构构建
|
||
docker buildx build --pull \
|
||
--platform linux/amd64,linux/arm64 \
|
||
--build-arg P2POOL_VERSION=v4.9.1 \
|
||
--output type=local,dest=./output \
|
||
-f docker/Dockerfile.alpine .
|
||
```
|
||
|
||
### Ubuntu 构建
|
||
|
||
```bash
|
||
docker buildx build --pull \
|
||
--platform linux/amd64 \
|
||
--build-arg P2POOL_VERSION=v4.9.1 \
|
||
--output type=local,dest=./output \
|
||
-f docker/Dockerfile.ubuntu .
|
||
```
|
||
|
||
## 构建 Debian 包
|
||
|
||
```bash
|
||
# 打包二进制文件
|
||
TARGZ="p2pool-amd64-ubuntu-v4.12.tar.gz"
|
||
tar -czf "${TARGZ}" -C ./output/linux_amd64 .
|
||
|
||
# 生成 Debian 包
|
||
./debian/build-deb.sh amd64 v4.12 "${TARGZ}"
|
||
```
|
||
|
||
## 常见问题排查
|
||
|
||
### 调整编译并行度
|
||
|
||
修改 Dockerfile 中的 `MAKE_JOBS` 变量:
|
||
|
||
```dockerfile
|
||
# 使用全部 CPU 核心(amd64)
|
||
elif [ "$TARGETARCH" = "amd64" ]; then \
|
||
MAKE_JOBS="-j$(nproc)";
|
||
|
||
# 或使用固定作业数
|
||
elif [ "$TARGETARCH" = "amd64" ]; then \
|
||
MAKE_JOBS="-j4";
|
||
```
|
||
|
||
### 网络和依赖问题
|
||
|
||
- 确保 Docker 可以访问互联网
|
||
- 检查 Git 子模块是否正确初始化
|
||
- 验证 CMake 和编译器版本兼容性
|
||
|
||
## 性能提示
|
||
|
||
- 使用 SSD 提高构建速度
|
||
- 保持 Docker 镜像和依赖更新
|
||
- 对于大型项目,考虑使用构建缓存 |