diff --git a/.github/workflows/docker-stable.yml b/.github/workflows/docker-stable.yml new file mode 100644 index 000000000..b835385c5 --- /dev/null +++ b/.github/workflows/docker-stable.yml @@ -0,0 +1,69 @@ +name: Docker stable + +# ghcr.io/yetone/magpie:stable is the image of the desktop app's Stable +# release (Settings › Update channel › Stable; jorbenzhu on Discord). Which +# release that is, is decided in one place only, site/worker.js's stableOf +# (a weekly pick out three days, or an urgent release at once), and served +# at /api/latest?channel=stable. This only reads that answer and points +# :stable at the image already built for that version (docker.yml); it +# never builds, and never touches latest, edge or a version's tags. While +# the feed can't be read the tag stays where it was. + +on: + schedule: + - cron: '23 * * * *' + # a release's image is pushed: an urgent one is Stable at once + workflow_run: + workflows: [Docker] + types: [completed] + workflow_dispatch: + +concurrency: + group: docker-stable + cancel-in-progress: false + +env: + IMAGE: ghcr.io/${{ github.repository_owner }}/magpie + FEED: https://usemagpie.ai/api/latest?channel=stable + +jobs: + stable: + if: github.repository == 'yetone/magpie' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: write + steps: + - uses: docker/setup-buildx-action@v4 + + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Point stable at the Stable release's image + run: | + set -euo pipefail + if ! BODY=$(curl -fsS --retry 3 --max-time 30 "$FEED"); then + echo "::warning::the Stable feed couldn't be read; $IMAGE:stable stays where it was" + exit 0 + fi + V=$(jq -r '.version // empty' <<<"$BODY") + if [[ ! "$V" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::warning::the Stable feed named no release ($V); $IMAGE:stable stays where it was" + exit 0 + fi + # an image is the platforms' manifests in it, however its index + # is written + digest() { docker buildx imagetools inspect "$1" --format '{{json .}}' | jq -er '[.manifest.manifests[]?.digest] | sort | join(",") | select(. != "")'; } + WANT=$(digest "$IMAGE:$V") # no image for the Stable release is a red run + HAVE=$(digest "$IMAGE:stable" 2>/dev/null || true) + if [[ "$HAVE" == "$WANT" ]]; then + echo "$IMAGE:stable is $V already ($WANT)" + exit 0 + fi + docker buildx imagetools create -t "$IMAGE:stable" "$IMAGE:$V" + GOT=$(digest "$IMAGE:stable") + echo "$IMAGE:stable is now $V ($GOT, was ${HAVE:-none})" + test "$GOT" == "$WANT" diff --git a/site/public/docs/docker.html b/site/public/docs/docker.html index 484e46045..fe123d377 100644 --- a/site/public/docs/docker.html +++ b/site/public/docs/docker.html @@ -90,7 +90,7 @@
- + diff --git a/site/public/docs/ja/docker.html b/site/public/docs/ja/docker.html index 6d1b08f26..f68156848 100644 --- a/site/public/docs/ja/docker.html +++ b/site/public/docs/ja/docker.html @@ -90,7 +90,7 @@
Imageghcr.io/yetone/magpie, for linux/amd64 and linux/arm64
Tagslatest (the newest release), 0.1.1150 (one release), 0.1, edge (every change on main)
Tagslatest (the newest release), stable (the desktop app's Stable channel: a release a week, out three days first, or an urgent one at once), 0.1.1150 (one release), 0.1, edge (every change on main)
Ports3425 the gateway agents call; 3430 the browser UI, when the container runs magpie web; it answers the gateway’s /v1 routes too, so a reverse proxy needs only this port
Volume/config: providers, keys, sign-ins, plugins and usage
Usernonroot (uid 65532)
- + diff --git a/site/public/docs/zh/docker.html b/site/public/docs/zh/docker.html index d65665e9e..089613ac6 100644 --- a/site/public/docs/zh/docker.html +++ b/site/public/docs/zh/docker.html @@ -90,7 +90,7 @@
イメージghcr.io/yetone/magpie(linux/amd64 と linux/arm64)
タグlatest(最新リリース)、0.1.1150(特定のリリース)、0.1、edge(main の変更ごと)
タグlatest(最新リリース)、stable(デスクトップ版の Stable チャンネルと同じ:公開から 3 日たったリリースが週に 1 つ、緊急リリースはすぐ)、0.1.1150(特定のリリース)、0.1、edge(main の変更ごと)
ポート3425 はエージェントが呼ぶゲートウェイ、3430 はコンテナが magpie web を動かすときのブラウザ UI。ゲートウェイの /v1 ルートにも応えるので、リバースプロキシはこのポートだけで足ります
ボリューム/config:プロバイダ、キー、サインイン、プラグイン、使用量
ユーザーnonroot(uid 65532)
- + diff --git a/site/worker.js b/site/worker.js index 2101bfebc..5dd7c293c 100644 --- a/site/worker.js +++ b/site/worker.js @@ -558,7 +558,8 @@ async function releases(ctx, env) { // first) and "notes:" each day's notes by version, which // /api/notes reads for a range older than the hundred newest. Without the // ledger, or one that doesn't reach back to the week's cut, Stable isn't -// known and the feed says so (503) rather than guess. +// known and the feed says so (503) rather than guess. The Docker image's +// stable tag follows this feed (.github/workflows/docker-stable.yml). const DAY = 86400e3; const SOAK = 3 * DAY; const LEDGER_DAYS = 45;
镜像ghcr.io/yetone/magpie,支持 linux/amd64 和 linux/arm64
标签latest(最新正式版)、0.1.1150(某个版本)、0.1、edge(main 上的每次改动)
标签latest(最新正式版)、stable(与桌面版的稳定版通道一致:每周一个已发布满三天的版本,紧急修复版立即跟上)、0.1.1150(某个版本)、0.1、edge(main 上的每次改动)
端口3425 是 Agent 调用的网关;3430 是容器运行 magpie web 时的 Web 界面;它也响应网关的 /v1 路由,所以反向代理只需转发这一个端口
数据卷/config:供应商、密钥、登录、插件和用量
用户nonroot(uid 65532)