Wechaty Docker Multi-Platform for Raspberry Pi (ARM)

For a long time, wechaty docker image was build for platform amd64. Today, Wechaty is supporting new platform: Raspberry Pi (ARM)!

TL;DR

Start from Wechaty version 1.11, you can use the Wechaty docker image directly with the Raspberry Pi!

$ uname -m
arm64

$ docker run --rm -it wechaty/wechaty:1.11 bot.ts
# It just works!

Technical Details

The story begin with https://github.com/wechaty/wechaty-puppet-wechat/pull/102 which let us know that some community users can start running wechaty-puppet-wechat and wechaty-puppet-whatsapp on Raspberry Pi.

At the same time, from this GitHub action script, we know how to build and publish multiple platform docker images.

So we decide to support multi-platform for Wechaty, and now it comes from the community.

Great thanks @Yc-Chen who has sent PR #2306 to support multi-platform docker image by fixing the compatible issue with the Google Chrome.

Finally, we can support multi-platform docker image for Wechaty by adding the following steps:

1. Enable QEMU & buildx in GitHub Actions

- name: Set up QEMU
    uses: docker/setup-qemu-action@v1
    with:
      platforms: all

  # https://github.com/docker/setup-buildx-action
  - name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v1
    with:
      install: true
      version: latest

2. Use buildx in our build script

We will use buildx to build multi-platform docker image for Wechaty in our scripts/docker.sh:

docker buildx build\
  --platform linux/amd64,linux/arm64,linux/arm/v7 \
  --tag "wechaty/wechaty:next" \
  --push \
  .
  1. --platform linux/amd64,linux/arm64,linux/arm/v7 means we will build for those platforms
  2. --push means we will push the multi-platforms image to Docker Hub

3. Increase the TAP timeout

The buildx seems to work perfectly, but the arm arch will take almost 10X times than the x86_64 when we are building:

For npm install:

=> [linux/amd64  6/13] RUN  npm install   && rm -fr /tmp/* ~/.npm  185.1s
 => [linux/arm64  6/13] RUN  npm install   && rm -fr /tmp/* ~/.npm  1473.2s
 => [linux/arm/v7 6/13] RUN  npm install   && rm -fr /tmp/* ~/.npm  1469.4s

For npm test:

=> [linux/amd64  9/13] RUN  npm test   && npm run dist   && npm link   165.5s
 => [linux/arm64  9/13] RUN  npm test   && npm run dist   && npm link   1482.5s
 => [linux/arm/v7 9/13] RUN  npm test   && npm run dist   && npm link   1295.2s

For puppet-install:

=> [linux/amd64  10/13] RUN  npm run puppet-install  113.3s
 => [linux/arm64  10/13] RUN  npm run puppet-install  219.1s
 => [linux/arm/v7 10/13] RUN  npm run puppet-install  444.4s

So we have to increase the TAP_TIMEOUT from the 60 seconds (the default) to 600 seconds, to make sure the unit tests are finished in time.

Total GitHub Action will take about 1.5 hours to finish building and pushing multi-platform docker image for Wechaty:

Deploy to DockerHub: 1h 38m 49s

Published: Multi-arch enable Docker Image

Docker Multi Arch: amd64 & arm64 & arm/v7

$ docker pull wechaty/wechaty:1.11

OS/ARCH         COMPRESSED SIZE 
linux/amd64     958.55 MB
linux/arm64     667.1 MB
linux/arm/v7    871.55 MB

Image credit: Docker Multi-Platform Images

结合我们之前沟通及操作历史记录,就我以下系统及操作记录作出下一步操作指命,不要跨步,我会依据执行结果反馈给你,你再依据所有信息分板如何进行下一步操作。 硬件:斐讯N1盒子 底层ARMBIAN系统信息: _ _ _ ___ ___ /_\ _ _ _ __ | |__(_)__ _ _ _ / _ \/ __| / _ \| '_| ' \| '_ \ / _` | ' \ | (_) \__ \ /_/ \_\_| |_|_|_|_.__/_\__,_|_||_| \___/|___/ v25.08.0 for Aml.S905d running Armbian Linux 5.15.186-ophub Packages: Debian stable (bullseye) IPv4: (LAN) 192.168.1.7 (WAN) 113.78.***.*** Performance: Load: 14% Uptime: 2:05 Memory usage: 26% of 1.76G CPU temp: 49°C Usage of /: 42% of 6.4G storage/: 10% of 29G RX today: 303 MiB Commands: 1PANEL安装日志: [1Panel Log]: Docker 服务已成功重启。 设置 1Panel 端口 (默认是 14687): [1Panel Log]: 您设置的端口是: 14687 设置 1Panel 安全入口 (默认是 8382ffe897): haoyong [1Panel Log]: 您设置的面板安全入口是 haoyong 设置 1Panel 面板用户 (默认是 39e66cce8f): haoyong [1Panel Log]: 您设置的面板用户是 haoyong [1Panel Log]: 设置 1Panel 面板密码,设置后按回车键继续 (默认是 1f8ae2a537): ************** [1Panel Log]: 正在配置 1Panel 服务 Created symlink /etc/systemd/system/multi-user.target.wants/1panel-agent.service → /etc/systemd/system/1panel-agent.service. Created symlink /etc/systemd/system/multi-user.target.wants/1panel-core.service → /etc/systemd/system/1panel-core.service. [1Panel Log]: 正在启动 1Panel 服务 [1Panel Log]: 1Panel 服务已成功启动,正在继续执行后续配置,请稍候... [1Panel Log]: [1Panel Log]: =================感谢您的耐心等待,安装已完成================== [1Panel Log]: [1Panel Log]: 请使用您的浏览器访问面板: [1Panel Log]: 外部地址: http://113.78.237.211:14687/haoyong [1Panel Log]: 内部地址: http://192.168.1.7:14687/haoyong [1Panel Log]: 面板用户: haoyong [1Panel Log]: 面板密码: SANDking100005 [1Panel Log]: [1Panel Log]: 官方网站: https://1panel.cn [1Panel Log]: 项目文档: https://1panel.cn/docs [1Panel Log]: 代码仓库: https://github.com/1Panel-dev/1Panel [1Panel Log]: 前往 1Panel 官方论坛获取帮助: https://bbs.fit2cloud.com/c/1p/7 [1Panel Log]: [1Panel Log]: 如果您使用的是云服务器,请在安全组中打开端口 14687 [1Panel Log]: [1Panel Log]: 为了您的服务器安全,离开此屏幕后您将无法再次看到您的密码,请记住您的密码。 [1Panel Log]: [1Panel Log]: ================================================================ root@armbian:~# mysql安装内容: 安装 名称 mysql 版本 Root 密码 100005 端口 3306 容器名称 可以为空,为空自动生成 允许端口外部访问会放开防火墙端口 CPU 限制 0 核心数 限制为 0 则关闭限制,最大可用为 4核 内存限制 0 限制为 0 则关闭限制,最大可用为 1800.98MB 在应用启动之前执行 docker pull 来拉取镜像 编辑 compose 文件可能导致软件安装失败 系统相关检查如下: root@armbian:~# uname -m aarch64 root@armbian:~# uname -r 5.15.186-ophub root@armbian:~# lsb_release -a || cat /etc/os-release No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye root@armbian:~# free -h total used free shared buff/cache available Mem: 1.8Gi 447Mi 598Mi 19Mi 755Mi 1.2Gi Swap: 900Mi 0B 900Mi root@armbian:~# nproc nproc 4 4 root@armbian:~# free -h total used free shared buff/cache available Mem: 1.8Gi 445Mi 599Mi 19Mi 755Mi 1.2Gi Swap: 900Mi 0B 900Mi root@armbian:~# df -h / Filesystem Size Used Avail Use% Mounted on /dev/mmcblk2p2 6.4G 2.7G 3.7G 42% / root@armbian:~# sudo ss -tulpn | grep -E '80|443|3306|6379' tcp LISTEN 0 4096 0.0.0.0:14687 0.0.0.0:* users:(("1panel",pid=801,fd=11)) root@armbian:~# curl -I https://xibo.org.uk HTTP/2 301 server: nginx date: Sat, 19 Jul 2025 07:14:41 GMT content-type: text/html content-length: 169 location: https://xibosignage.com/ referrer-policy: no-referrer-when-downgrade strict-transport-security: max-age=31536000 root@armbian:~# 拉取源的测试如下: oot@armbian:~# docker images | grep hello-world hello-world latest f1f77a0f96b7 5 months ago 5.2kB root@armbian:~# docker images | grep hello-world hello-world latest f1f77a0f96b7 5 months ago 5.2kB root@armbian:~# docker history hello-world IMAGE CREATED CREATED BY SIZE COMMENT f1f77a0f96b7 5 months ago CMD ["/hello"] 0B buildkit.dockerfile.v0 <missing> 5 months ago COPY hello / # buildkit 5.2kB buildkit.dockerfile.v0 root@armbian:~# ^C
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值