Skip to content

Commit 47f5409

Browse files
committed
ci: build both ARM64 and AMD64 docker image
1 parent acb2e42 commit 47f5409

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

.dockerignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
.idea
55
.kotlin
66
**/build
7-
!yogurt/build/
8-
!yogurt/build/bin/
9-
!yogurt/build/bin/linuxX64/
10-
!yogurt/build/bin/linuxX64/releaseExecutable/
11-
!yogurt/build/bin/linuxX64/releaseExecutable/yogurt.kexe
127
**/node_modules
138
acidify-core-js
149
acidify-docs

.github/workflows/build-yogurt-pmhq.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,22 @@ jobs:
207207
uses: actions/download-artifact@v4
208208
with:
209209
name: yogurt-linux-x64
210-
path: yogurt/build/bin/linuxX64/releaseExecutable
210+
path: docker/bin/linux-amd64
211+
212+
- name: Download linux-arm64 executable
213+
uses: actions/download-artifact@v4
214+
with:
215+
name: yogurt-linux-arm64
216+
path: docker/bin/linux-arm64
217+
218+
- name: Normalize Docker binaries
219+
run: |
220+
set -euo pipefail
221+
mv docker/bin/linux-amd64/yogurt.kexe docker/bin/linux-amd64/yogurt
222+
mv docker/bin/linux-arm64/yogurt.kexe docker/bin/linux-arm64/yogurt
223+
224+
- name: Set up QEMU
225+
uses: docker/setup-qemu-action@v3
211226

212227
- name: Set up Docker Buildx
213228
uses: docker/setup-buildx-action@v3
@@ -241,7 +256,7 @@ jobs:
241256
with:
242257
context: .
243258
file: docker/Dockerfile
244-
platforms: linux/amd64
259+
platforms: linux/amd64,linux/arm64
245260
push: true
246261
tags: ${{ steps.docker_meta.outputs.tags }}
247262
labels: ${{ steps.docker_meta.outputs.labels }}

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
privileged: true
2121
environment:
2222
- ENABLE_HEADLESS=true
23-
- RUST_LOG=error # Suppress PMHQ log to make Yogurt log visible
23+
- RUST_LOG=error
2424
volumes:
2525
- qq_volume:/root/.config/QQ
2626
networks:
@@ -36,13 +36,12 @@ services:
3636
yogurt:
3737
image: ghcr.io/llonebot/yogurt-pmhq:latest
3838
container_name: yogurt-pmhq
39-
platform: linux/amd64
4039
environment:
4140
- PMHQ_HOST=pmhq
4241
- PMHQ_PORT=13000
4342
- YOGURT_HOST=0.0.0.0
4443
- YOGURT_PORT=3000
45-
- YOGURT_ACCESS_TOKEN=change-me
44+
- YOGURT_ACCESS_TOKEN=change-me # 请在此修改 Access Token,确保安全
4645
- HTTP_CORS_ORIGINS=
4746
- WEBHOOK_URLS=
4847
- WEBHOOK_ACCESS_TOKEN=
@@ -87,7 +86,7 @@ Yogurt 支持三种登录方式:当前登录状态继续、快速登录和二
8786
- 如果已经登录,则直接进入初始化;
8887
- 如果尚未登录,则进入二维码登录。
8988

90-
PMHQ 的 QQ 配置目录会挂载到独立卷 `qq_volume`。Yogurt 的运行目录会挂载到 `./data`,启动时自动生成 `config.json` 和脚本目录,适合长期保留登录状态与本地数据。镜像内部运行的是 `linuxX64` 的 Kotlin/Native 可执行文件
89+
PMHQ 的 QQ 配置目录会挂载到独立卷 `qq_volume`。Yogurt 的运行目录会挂载到 `./data`,启动时自动生成 `config.json` 和脚本目录,适合长期保留登录状态与本地数据。当前发布的 Docker 镜像同时包含 `amd64` 和 `arm64` 两种架构,Docker 会按宿主机自动拉取对应的原生二进制镜像
9190

9291
Yogurt 容器额外写入了 `host.docker.internal:host-gateway`,因此 webhook 或其他回调服务如果运行在宿主机上,也可以直接从容器内访问。如果你确实需要从宿主机直接访问 PMHQ,再自行给 `pmhq` 服务补端口映射即可。
9392

docker/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
FROM debian:bookworm-slim
22

3+
ARG TARGETARCH
4+
35
RUN apt-get update \
46
&& apt-get install -y --no-install-recommends ca-certificates jq libcurl4 \
57
&& rm -rf /var/lib/apt/lists/*
68

79
WORKDIR /app
810

9-
COPY yogurt/build/bin/linuxX64/releaseExecutable/yogurt.kexe /app/yogurt
11+
COPY docker/bin /tmp/docker-bin
1012
COPY docker/startup.sh /app/startup.sh
1113

12-
RUN chmod +x /app/startup.sh /app/yogurt
14+
RUN cp "/tmp/docker-bin/linux-${TARGETARCH}/yogurt" /app/yogurt \
15+
&& rm -rf /tmp/docker-bin \
16+
&& chmod +x /app/startup.sh /app/yogurt
1317

1418
ENV YOGURT_DATA_DIR=/app/data
1519

0 commit comments

Comments
 (0)