🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
ci(docker): 发版时把 x64 + arm64 镜像发布到 GHCR,README 改成一条 docker run
dyk987ecee7b0349c
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlnew file mode 100644index 0000000..44785a2--- /dev/null+++ b/.github/workflows/docker.yml@@ -0,0 +1,208 @@+# Docker: publish the app image to GitHub Container Registry (GHCR) on every release.+#+# How to use+# - Release: pushing a tag `v<version>` (the same tag that starts the Release workflow) builds the+# image for linux/amd64 and linux/arm64 and publishes it as+# ghcr.io/modelflare-ai/anymodel-bot:<version> every release+# ghcr.io/modelflare-ai/anymodel-bot:latest only releases without "-" (not v0.2.0-rc.1)+# Users then need one command (the README and the website show it):+# docker run -d --name amb -p 3600:3600 -v amb-data:/data ghcr.io/modelflare-ai/anymodel-bot+# - Publish an existing tag (one created before this workflow existed): Actions -> Docker ->+# "Run workflow" on master with `tag` set, e.g. v0.1.10. That tag is checked out and published.+# - Test build: "Run workflow" with `tag` empty, on any branch. Both architectures are built from+# that branch, nothing is pushed.+#+# One-time setup after the first publish: GHCR creates the package as private. Open+# github.com/orgs/modelflare-ai/packages -> anymodel-bot -> Package settings -> Change visibility ->+# Public, or `docker pull` asks users to log in.+#+# Each architecture builds on a runner of its own CPU (the image installs per-arch native packages+# in dsh-runtime, like the installers in release.yml) and pushes by digest; the merge job then joins+# the two digests into one multi-arch tag.++name: Docker++on:+ push:+ tags: ["v*"]+ workflow_dispatch:+ inputs:+ tag:+ description: "Release tag to publish (e.g. v0.1.10). Empty: test build of this branch, nothing is pushed."+ type: string+ default: ""++permissions:+ contents: read++concurrency:+ group: docker-${{ inputs.tag || github.ref }}+ cancel-in-progress: ${{ github.ref_type != 'tag' && inputs.tag == '' }}++env:+ # GHCR image names must be lowercase.+ IMAGE: ghcr.io/modelflare-ai/anymodel-bot++jobs:+ meta:+ name: Version check+ runs-on: ubuntu-24.04+ timeout-minutes: 5+ outputs:+ ref: ${{ steps.version.outputs.ref }}+ version: ${{ steps.version.outputs.version }}+ push: ${{ steps.version.outputs.push }}+ latest: ${{ steps.version.outputs.latest }}+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false+ ref: ${{ inputs.tag || github.ref }}+ sparse-checkout: package.json+ sparse-checkout-cone-mode: false++ - name: Read package.json version and match it against the tag+ id: version+ env:+ INPUT_TAG: ${{ inputs.tag }}+ REF_TYPE: ${{ github.ref_type }}+ REF_NAME: ${{ github.ref_name }}+ run: |+ version=$(node -p 'require("./package.json").version')+ tag=""+ if [ -n "$INPUT_TAG" ]; then tag=$INPUT_TAG; elif [ "$REF_TYPE" = tag ]; then tag=$REF_NAME; fi+ if [ -n "$tag" ] && [ "$tag" != "v$version" ]; then+ echo "::error::Tag $tag does not match package.json version $version (expected tag v$version)"+ exit 1+ fi+ if [ -n "$tag" ]; then+ echo "ref=refs/tags/$tag" >> "$GITHUB_OUTPUT"+ echo "push=true" >> "$GITHUB_OUTPUT"+ if [[ "$tag" == *-* ]]; then echo "latest=false" >> "$GITHUB_OUTPUT"; else echo "latest=true" >> "$GITHUB_OUTPUT"; fi+ echo "Publishing $IMAGE:$version"+ else+ echo "ref=$GITHUB_REF" >> "$GITHUB_OUTPUT"+ echo "push=false" >> "$GITHUB_OUTPUT"+ echo "latest=false" >> "$GITHUB_OUTPUT"+ echo "Test build of $GITHUB_REF ($version), nothing is pushed"+ fi+ echo "version=$version" >> "$GITHUB_OUTPUT"++ build:+ name: linux/${{ matrix.arch }}+ needs: meta+ runs-on: ${{ matrix.runner }}+ timeout-minutes: 45+ permissions:+ contents: read+ packages: write+ strategy:+ fail-fast: true+ matrix:+ include:+ - { arch: amd64, runner: ubuntu-24.04 }+ - { arch: arm64, runner: ubuntu-24.04-arm }+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false+ ref: ${{ needs.meta.outputs.ref }}++ # The Dockerfile compiles the bundled gateway from this submodule.+ - name: Fetch magpie+ run: git submodule update --init --depth 1 vendor/magpie++ - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1++ - uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0+ if: needs.meta.outputs.push == 'true'+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ github.token }}++ - name: Build${{ needs.meta.outputs.push == 'true' && ' and push by digest' || ' (test, not pushed)' }}+ id: build+ uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0+ with:+ context: .+ platforms: linux/${{ matrix.arch }}+ tags: ${{ env.IMAGE }}+ outputs: ${{ needs.meta.outputs.push == 'true' && 'type=image,push-by-digest=true,name-canonical=true,push=true' || 'type=cacheonly' }}+ # No attestation manifests: registry UIs and NAS apps list them as an extra "unknown/unknown" platform.+ provenance: false+ sbom: false+ labels: |+ org.opencontainers.image.title=AnyModelBot+ org.opencontainers.image.description=Local-first AI bots with any model, pay as you go+ org.opencontainers.image.source=https://github.com/${{ github.repository }}+ org.opencontainers.image.url=https://anymodel.bot/+ org.opencontainers.image.version=${{ needs.meta.outputs.version }}+ org.opencontainers.image.revision=${{ github.sha }}+ org.opencontainers.image.licenses=MIT+ cache-from: type=gha,scope=docker-${{ matrix.arch }}+ cache-to: type=gha,mode=max,scope=docker-${{ matrix.arch }}++ - name: Export digest+ if: needs.meta.outputs.push == 'true'+ env:+ DIGEST: ${{ steps.build.outputs.digest }}+ run: |+ mkdir -p "$RUNNER_TEMP/digests"+ touch "$RUNNER_TEMP/digests/${DIGEST#sha256:}"++ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2+ if: needs.meta.outputs.push == 'true'+ with:+ name: docker-digest-${{ matrix.arch }}+ path: ${{ runner.temp }}/digests/*+ if-no-files-found: error+ overwrite: true+ retention-days: 1++ merge:+ name: Publish multi-arch tags+ needs: [meta, build]+ if: needs.meta.outputs.push == 'true'+ runs-on: ubuntu-24.04+ timeout-minutes: 10+ permissions:+ contents: read+ packages: write+ steps:+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2+ with:+ pattern: docker-digest-*+ path: ${{ runner.temp }}/digests+ merge-multiple: true++ - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1++ - uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ github.token }}++ - name: Create the multi-arch tags+ working-directory: ${{ runner.temp }}/digests+ env:+ VERSION: ${{ needs.meta.outputs.version }}+ LATEST: ${{ needs.meta.outputs.latest }}+ REPO_URL: https://github.com/${{ github.repository }}+ run: |+ tags=(-t "$IMAGE:$VERSION")+ if [ "$LATEST" = true ]; then tags+=(-t "$IMAGE:latest"); fi+ sources=()+ for d in *; do sources+=("$IMAGE@sha256:$d"); done+ if [ "${#sources[@]}" -ne 2 ]; then+ echo "::error::Expected 2 digests (amd64, arm64), found ${#sources[@]}"+ exit 1+ fi+ # Index annotations: GHCR reads the description and the source repository of a multi-arch image from here.+ docker buildx imagetools create "${tags[@]}" \+ --annotation "index:org.opencontainers.image.source=$REPO_URL" \+ --annotation "index:org.opencontainers.image.description=Local-first AI bots with any model, pay as you go" \+ --annotation "index:org.opencontainers.image.licenses=MIT" \+ "${sources[@]}"+ docker buildx imagetools inspect "$IMAGE:$VERSION"diff --git a/Dockerfile b/Dockerfileindex 1135995..e92ecb2 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,5 +1,6 @@# anymodel bot:一个镜像同时包含机器人运行时 + 内置 magpie 模型网关-# 构建前需检出子模块:git submodule update --init --depth 1 vendor/magpie+# 发版时由 .github/workflows/docker.yml 发布到 ghcr.io/modelflare-ai/anymodel-bot(x64 + arm64),用户直接 docker run 那个镜像。+# 自己构建前需检出子模块:git submodule update --init --depth 1 vendor/magpie# docker build -t anymodel-bot .# docker run -d --name amb -p 3600:3600 -v amb-data:/data anymodel-bot# docker exec amb cat /data/ui-token # 首次打开 http://<主机>:3600/?token=<令牌>diff --git a/README.md b/README.mdindex 28d7cf9..2e6d8de 100644--- a/README.md+++ b/README.md@@ -112,7 +112,16 @@ sha256sum -c SHA256SUMS --ignore-missingmacOS 用 `shasum -a 256 <文件名>`,Windows PowerShell 用 `Get-FileHash <文件名>`,再和 `SHA256SUMS` 里的值对照。-**从源码运行,或用 Docker**+**用 Docker 部署到 NAS 或服务器**(镜像同时支持 x64 和 arm64)++```bash+docker run -d --name amb -p 3600:3600 -v amb-data:/data ghcr.io/modelflare-ai/anymodel-bot+docker exec amb cat /data/ui-token # 然后打开 http://<主机>:3600/?token=<令牌>+```++不要把 3600 端口直接暴露到公网。++**从源码运行**```bashgit clone https://github.com/modelflare-ai/AnyModelBot.git@@ -122,14 +131,7 @@ npm run setup # 拉取并编译内置网关npm start # 本地管理界面:http://127.0.0.1:3600/```-```bash-git submodule update --init --depth 1 vendor/magpie # 镜像要从源码编译内置网关-docker build -t anymodel-bot .-docker run -d --name amb -p 3600:3600 -v amb-data:/data anymodel-bot-docker exec amb cat /data/ui-token # 然后打开 http://<主机>:3600/?token=<令牌>-```--从源码构建需要 Node.js 22.13+ 和 Go 1.26.8+。更多内容见[开发文档](./docs/development.md)。+从源码构建需要 Node.js 22.13+ 和 Go 1.26.8+。想自己构建 Docker 镜像,见[开发文档](./docs/development.md)。# 🌠 截图diff --git a/README_en.md b/README_en.mdindex bf757e6..61499bf 100644--- a/README_en.md+++ b/README_en.md@@ -112,7 +112,16 @@ sha256sum -c SHA256SUMS --ignore-missingOn macOS use `shasum -a 256 <file>`; in Windows PowerShell use `Get-FileHash <file>`. Compare the result with the line in `SHA256SUMS`.-**Run from source or in Docker**+**Run it in Docker on a NAS or server** (the image covers both x64 and arm64)++```bash+docker run -d --name amb -p 3600:3600 -v amb-data:/data ghcr.io/modelflare-ai/anymodel-bot+docker exec amb cat /data/ui-token # then open http://<host>:3600/?token=<token>+```++Don't expose port 3600 directly to the internet.++**Run from source**```bashgit clone https://github.com/modelflare-ai/AnyModelBot.git@@ -122,14 +131,7 @@ npm run setup # fetches and builds the bundled gatewaynpm start # opens the local console at http://127.0.0.1:3600/```-```bash-git submodule update --init --depth 1 vendor/magpie # the image builds the gateway from source-docker build -t anymodel-bot .-docker run -d --name amb -p 3600:3600 -v amb-data:/data anymodel-bot-docker exec amb cat /data/ui-token # then open http://<host>:3600/?token=<token>-```--Requirements for building from source: Node.js 22.13+ and Go 1.26.8+. More in the [development guide](./docs/development_en.md).+Requirements for building from source: Node.js 22.13+ and Go 1.26.8+. To build the Docker image yourself, see the [development guide](./docs/development_en.md).# 🌠 Screenshotsdiff --git a/docs/development.md b/docs/development.mdindex 920bc11..7620dc5 100644--- a/docs/development.md+++ b/docs/development.md@@ -66,10 +66,12 @@ npm run test:dsh-bundle # 用 Electron 跑真实 DSH 集成测试,加载打- 界面只监听 127.0.0.1,且每次启动生成随机访问令牌,其他本机程序无法直接调用管理接口。- 退出时先停渠道、再停 magpie;若上次被强杀残留 magpie 进程,下次启动会自动清理(Linux/macOS)。-发布:改 `package.json` 的版本号并提交,推送 `v<版本>` 标签,`.github/workflows/release.yml` 会在六种系统 / 架构上各自打包,并把安装包和 `SHA256SUMS` 发到 GitHub Release。签名与公证所需的仓库密钥见该文件开头的注释。+发布:改 `package.json` 的版本号并提交,推送 `v<版本>` 标签,`.github/workflows/release.yml` 会在六种系统 / 架构上各自打包,并把安装包和 `SHA256SUMS` 发到 GitHub Release。签名与公证所需的仓库密钥见该文件开头的注释。同一个标签还会触发 `.github/workflows/docker.yml`,把 x64 + arm64 镜像发布到 `ghcr.io/modelflare-ai/anymodel-bot`(`<版本>` 和 `latest` 两个标签)。## Docker+用户直接用已发布的镜像:`docker run -d --name amb -p 3600:3600 -v amb-data:/data ghcr.io/modelflare-ai/anymodel-bot`。下面是从源码自己构建:+```bashgit submodule update --init --depth 1 vendor/magpiedocker build -t anymodel-bot .diff --git a/docs/development_en.md b/docs/development_en.mdindex 25aeeba..8b2fd01 100644--- a/docs/development_en.md+++ b/docs/development_en.md@@ -66,10 +66,12 @@ npm run test:dsh-bundle # real DSH integration test under Electron against the- The console listens on 127.0.0.1 only and generates a random access token on every launch, so other local programs cannot call the management API directly.- On quit, channels stop first, then magpie. If a previous run was killed and left a magpie process behind, the next launch cleans it up (Linux/macOS).-Releases: bump `version` in `package.json`, commit, and push a `v<version>` tag. `.github/workflows/release.yml` builds on each of the six OS / architecture runners and publishes the installers plus `SHA256SUMS` to a GitHub Release. The repository secrets needed for signing and notarization are described in the comment at the top of that file.+Releases: bump `version` in `package.json`, commit, and push a `v<version>` tag. `.github/workflows/release.yml` builds on each of the six OS / architecture runners and publishes the installers plus `SHA256SUMS` to a GitHub Release. The repository secrets needed for signing and notarization are described in the comment at the top of that file. The same tag also starts `.github/workflows/docker.yml`, which publishes the x64 + arm64 image to `ghcr.io/modelflare-ai/anymodel-bot` (tagged `<version>` and `latest`).## Docker+Users run the published image: `docker run -d --name amb -p 3600:3600 -v amb-data:/data ghcr.io/modelflare-ai/anymodel-bot`. To build it from source yourself:+```bashgit submodule update --init --depth 1 vendor/magpiedocker build -t anymodel-bot .