docker: a daily tag that moves once a day, for Renovate
magpie releases many times a day, and YaoFur on X runs the image with
Renovate, which opened a PR on every tag ("改成每天凌晨更新一次").
Releases stay as fast as they are. ghcr.io/yetone/magpie:daily is new:
.github/workflows/docker-daily.yml points it at :latest's image once a
day, at 20:00 UTC (04:00 in China), by digest, as docker-stable.yml does
for :stable. It never builds, and touches no other tag; a click on Run
workflow moves it too. A Renovate user follows daily with its digest
pinned and gets at most one PR a day; stable is still there for one a
week.
The docs name it: the Tags row and the Updates line of the Docker page in
en, zh and ja, and the Docker section of docs/reference.md.
site/docker-tags.test.mjs holds that the three languages name the same
floating tags with daily among them, that a workflow writes each tag the
docs name, and that daily has one daily schedule, copies latest and
builds nothing.
The desktop app is unchanged: it already checks every 6 hours by
default, and Settings > About offers Check every 24 h and the Stable
channel (one a week).
Run (mote): node --test site/*.test.mjs, 90 of 90 ok; without the
workflow and the docs, two of docker-tags' three tests are red.
actionlint on docker-daily.yml and docker-stable.yml: clean. No Go file
changed; go test ./... -timeout 45m runs on the Linux box (wsl-run) at
this tree, since mote had another session's full suite running.
Not tried: the workflow itself before this push; it is run once with
workflow_dispatch right after it.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
name: Docker daily
|
||||
|
||||
# ghcr.io/yetone/magpie:daily is the newest release's image, moved once a
|
||||
# day: magpie releases many times a day, and Renovate opened a PR for each
|
||||
# one (YaoFur on X, "改成每天凌晨更新一次"). At 20:00 UTC (04:00 in
|
||||
# China) it points :daily at whatever :latest is then, by digest; it never
|
||||
# builds, and never touches latest, stable, edge or a version's tags.
|
||||
# Releases themselves go out as fast as ever.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 20 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: docker-daily
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
IMAGE: ghcr.io/${{ github.repository_owner }}/magpie
|
||||
|
||||
jobs:
|
||||
daily:
|
||||
if: github.repository == 'yetone/magpie'
|
||||
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 daily at the newest release's image
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# 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:latest") # no latest image is a red run
|
||||
HAVE=$(digest "$IMAGE:daily" 2>/dev/null || true)
|
||||
if [[ "$HAVE" == "$WANT" ]]; then
|
||||
echo "$IMAGE:daily is latest already ($WANT)"
|
||||
exit 0
|
||||
fi
|
||||
docker buildx imagetools create -t "$IMAGE:daily" "$IMAGE:latest"
|
||||
GOT=$(digest "$IMAGE:daily")
|
||||
echo "$IMAGE:daily is now latest ($GOT, was ${HAVE:-none})"
|
||||
test "$GOT" == "$WANT"
|
||||
@@ -3295,6 +3295,13 @@ container. For Internet access, prefer a
|
||||
VPN such as Tailscale or WireGuard; a reverse proxy or tunnel forwarding to
|
||||
Magpie over loopback needs a gateway key from its clients, as the network does.
|
||||
|
||||
The image's tags: `latest` is the newest release, and magpie releases
|
||||
several times a day. `daily` is the newest release as of 20:00 UTC, moved
|
||||
once a day (`.github/workflows/docker-daily.yml`), for Renovate or
|
||||
Watchtower to update at most daily (with Renovate, pin its digest);
|
||||
`stable` is the desktop app's Stable channel, one a week. `0.1.N` is one
|
||||
release, `0.1` the newest of its line, and `edge` every change on `main`.
|
||||
|
||||
### Developing
|
||||
|
||||
```sh
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// node --test site/: the Docker image's tags the docs name are tags a
|
||||
// workflow writes. magpie releases many times a day, and a Renovate user
|
||||
// had a PR for each one (YaoFur on X): daily moves once a day, by
|
||||
// .github/workflows/docker-daily.yml, and is in the docs in every language.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync, readdirSync } from "node:fs";
|
||||
|
||||
const read = (p) => readFileSync(new URL(p, import.meta.url), "utf8");
|
||||
const workflows = readdirSync(new URL("../.github/workflows/", import.meta.url))
|
||||
.filter((f) => /\.ya?ml$/.test(f))
|
||||
.map((f) => [f, read("../.github/workflows/" + f)]);
|
||||
|
||||
// the floating tags in the Tags row of the docs' table (a version's tags,
|
||||
// 0.1.1150 and 0.1, are left out)
|
||||
function tagsIn(page) {
|
||||
const row = read(page).split("\n").find((l) => /<tr><td><b>(Tags|标签|タグ)<\/b>/.test(l));
|
||||
assert.ok(row, page + ": no Tags row");
|
||||
return [...row.matchAll(/<code>([^<]+)<\/code>/g)].map((m) => m[1]).filter((c) => !/^\d/.test(c) && c !== "main").sort();
|
||||
}
|
||||
|
||||
const pages = ["./public/docs/docker.html", "./public/docs/zh/docker.html", "./public/docs/ja/docker.html"];
|
||||
|
||||
test("every language's docs name the same tags, daily among them", () => {
|
||||
const en = tagsIn(pages[0]);
|
||||
assert.ok(en.includes("daily"), "daily isn't in the Tags row: " + en);
|
||||
for (const p of pages.slice(1)) assert.deepEqual(tagsIn(p), en, p);
|
||||
});
|
||||
|
||||
test("every tag the docs name is one a workflow writes", () => {
|
||||
for (const tag of tagsIn(pages[0])) {
|
||||
const by = workflows.filter(([, y]) => y.includes(`"$IMAGE:${tag}"`)).map(([f]) => f);
|
||||
assert.ok(by.length, `no workflow writes $IMAGE:${tag}`);
|
||||
}
|
||||
});
|
||||
|
||||
test("daily moves once a day, to latest's image, without a build", () => {
|
||||
const y = read("../.github/workflows/docker-daily.yml");
|
||||
const crons = [...y.matchAll(/cron:\s*'([^']+)'/g)].map((m) => m[1]);
|
||||
assert.equal(crons.length, 1, "one schedule");
|
||||
const [min, hour, dom, mon, dow] = crons[0].split(/\s+/);
|
||||
assert.ok(/^\d+$/.test(min) && /^\d+$/.test(hour) && dom === "*" && mon === "*" && dow === "*", "once a day: " + crons[0]);
|
||||
assert.match(y, /imagetools create -t "\$IMAGE:daily" "\$IMAGE:latest"/);
|
||||
assert.doesNotMatch(y, /build-push-action|docker (buildx )?build\s/);
|
||||
assert.doesNotMatch(y, /workflow_run|push:|tags:/, "only the clock (and a click) moves it");
|
||||
});
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<div class="table-wrap"><table>
|
||||
<tr><td><b>Image</b></td><td><code>ghcr.io/yetone/magpie</code>, for <code>linux/amd64</code> and <code>linux/arm64</code></td></tr>
|
||||
<tr><td><b>Tags</b></td><td><code>latest</code> (the newest release), <code>stable</code> (the desktop app's Stable channel: a release a week, out three days first, or an urgent one at once), <code>0.1.1150</code> (one release), <code>0.1</code>, <code>edge</code> (every change on <code>main</code>)</td></tr>
|
||||
<tr><td><b>Tags</b></td><td><code>latest</code> (the newest release), <code>daily</code> (the newest release as of 20:00 UTC, moved once a day), <code>stable</code> (the desktop app's Stable channel: a release a week, out three days first, or an urgent one at once), <code>0.1.1150</code> (one release), <code>0.1</code>, <code>edge</code> (every change on <code>main</code>)</td></tr>
|
||||
<tr><td><b>Ports</b></td><td><code>3425</code> the gateway agents call; <code>3430</code> the browser UI, when the container runs <code>magpie web</code>; it answers the gateway’s <code>/v1</code> routes too, so a reverse proxy needs only this port</td></tr>
|
||||
<tr><td><b>Volume</b></td><td><code>/config</code>: providers, keys, sign-ins, plugins and usage</td></tr>
|
||||
<tr><td><b>User</b></td><td>nonroot (uid 65532)</td></tr>
|
||||
@@ -216,7 +216,7 @@ docker logs magpie</pre>
|
||||
<ul>
|
||||
<li><b>Health.</b> The image has a <code>HEALTHCHECK</code>: <code>magpie healthcheck</code> exits 0 while the gateway answers, under <code>serve</code> and <code>web</code> alike, so <code>docker ps</code> shows the container as healthy and Compose can wait for it with <code>depends_on: condition: service_healthy</code>.</li>
|
||||
<li><b>Terminal.</b> <code>docker exec -it magpie bash</code>, or a NAS panel’s terminal, opens a shell with <code>magpie</code> on its PATH: <code>magpie providers</code>, <code>magpie models</code>, <code>magpie usage</code>, <code>magpie quota</code> and the rest of the <a href="https://github.com/yetone/magpie/blob/main/docs/reference.md">CLI</a>.</li>
|
||||
<li><b>Updates.</b> Pull the new image and recreate the container on the same volume: <code>docker pull ghcr.io/yetone/magpie:latest</code>, then <code>docker rm -f magpie</code> and the same <code>docker run</code>, or <code>docker compose pull && docker compose up -d</code>.</li>
|
||||
<li><b>Updates.</b> Pull the new image and recreate the container on the same volume: <code>docker pull ghcr.io/yetone/magpie:latest</code>, then <code>docker rm -f magpie</code> and the same <code>docker run</code>, or <code>docker compose pull && docker compose up -d</code>. magpie releases several times a day; for one update a day with Renovate or Watchtower, follow <code>daily</code> (with Renovate, pin its digest), or <code>stable</code> for one a week.</li>
|
||||
<li><b>Build it yourself.</b> <code>docker build -t magpie .</code> in a checkout of <a href="https://github.com/yetone/magpie">the repository</a> makes the same image.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<div class="table-wrap"><table>
|
||||
<tr><td><b>イメージ</b></td><td><code>ghcr.io/yetone/magpie</code>(<code>linux/amd64</code> と <code>linux/arm64</code>)</td></tr>
|
||||
<tr><td><b>タグ</b></td><td><code>latest</code>(最新リリース)、<code>stable</code>(デスクトップ版の Stable チャンネルと同じ:公開から 3 日たったリリースが週に 1 つ、緊急リリースはすぐ)、<code>0.1.1150</code>(特定のリリース)、<code>0.1</code>、<code>edge</code>(<code>main</code> の変更ごと)</td></tr>
|
||||
<tr><td><b>タグ</b></td><td><code>latest</code>(最新リリース)、<code>daily</code>(毎日 20:00 UTC にその時点の最新リリースへ移る。1 日 1 回だけ)、<code>stable</code>(デスクトップ版の Stable チャンネルと同じ:公開から 3 日たったリリースが週に 1 つ、緊急リリースはすぐ)、<code>0.1.1150</code>(特定のリリース)、<code>0.1</code>、<code>edge</code>(<code>main</code> の変更ごと)</td></tr>
|
||||
<tr><td><b>ポート</b></td><td><code>3425</code> はエージェントが呼ぶゲートウェイ、<code>3430</code> はコンテナが <code>magpie web</code> を動かすときのブラウザ UI。ゲートウェイの <code>/v1</code> ルートにも応えるので、リバースプロキシはこのポートだけで足ります</td></tr>
|
||||
<tr><td><b>ボリューム</b></td><td><code>/config</code>:プロバイダ、キー、サインイン、プラグイン、使用量</td></tr>
|
||||
<tr><td><b>ユーザー</b></td><td>nonroot(uid 65532)</td></tr>
|
||||
@@ -216,7 +216,7 @@ docker logs magpie</pre>
|
||||
<ul>
|
||||
<li><b>ヘルスチェック。</b>イメージには <code>HEALTHCHECK</code> があります。ゲートウェイが応答している間 <code>magpie healthcheck</code> は 0 で終わり、<code>serve</code> でも <code>web</code> でも同じです。<code>docker ps</code> は healthy と表示し、Compose は <code>depends_on: condition: service_healthy</code> で待てます。</li>
|
||||
<li><b>ターミナル。</b><code>docker exec -it magpie bash</code> や NAS の管理画面のターミナルで、<code>magpie</code> が PATH にあるシェルが開きます:<code>magpie providers</code>、<code>magpie models</code>、<code>magpie usage</code>、<code>magpie quota</code> など、<a href="https://github.com/yetone/magpie/blob/main/docs/reference.md">CLI</a> のすべてが使えます。</li>
|
||||
<li><b>更新。</b>新しいイメージを取得し、同じボリュームでコンテナを作り直します:<code>docker pull ghcr.io/yetone/magpie:latest</code> のあと <code>docker rm -f magpie</code> と同じ <code>docker run</code>、または <code>docker compose pull && docker compose up -d</code>。</li>
|
||||
<li><b>更新。</b>新しいイメージを取得し、同じボリュームでコンテナを作り直します:<code>docker pull ghcr.io/yetone/magpie:latest</code> のあと <code>docker rm -f magpie</code> と同じ <code>docker run</code>、または <code>docker compose pull && docker compose up -d</code>。magpie は 1 日に何度もリリースされます。Renovate や Watchtower で 1 日 1 回だけ更新するなら <code>daily</code> を(Renovate ではダイジェストを固定して)、週 1 回なら <code>stable</code> を使います。</li>
|
||||
<li><b>自分でビルドする。</b><a href="https://github.com/yetone/magpie">リポジトリ</a>のチェックアウトで <code>docker build -t magpie .</code> を実行すると同じイメージができます。</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
<div class="table-wrap"><table>
|
||||
<tr><td><b>镜像</b></td><td><code>ghcr.io/yetone/magpie</code>,支持 <code>linux/amd64</code> 和 <code>linux/arm64</code></td></tr>
|
||||
<tr><td><b>标签</b></td><td><code>latest</code>(最新正式版)、<code>stable</code>(与桌面版的稳定版通道一致:每周一个已发布满三天的版本,紧急修复版立即跟上)、<code>0.1.1150</code>(某个版本)、<code>0.1</code>、<code>edge</code>(<code>main</code> 上的每次改动)</td></tr>
|
||||
<tr><td><b>标签</b></td><td><code>latest</code>(最新正式版)、<code>daily</code>(每天北京时间 04:00 指向当时的最新正式版,一天只变一次)、<code>stable</code>(与桌面版的稳定版通道一致:每周一个已发布满三天的版本,紧急修复版立即跟上)、<code>0.1.1150</code>(某个版本)、<code>0.1</code>、<code>edge</code>(<code>main</code> 上的每次改动)</td></tr>
|
||||
<tr><td><b>端口</b></td><td><code>3425</code> 是 Agent 调用的网关;<code>3430</code> 是容器运行 <code>magpie web</code> 时的 Web 界面;它也响应网关的 <code>/v1</code> 路由,所以反向代理只需转发这一个端口</td></tr>
|
||||
<tr><td><b>数据卷</b></td><td><code>/config</code>:供应商、密钥、登录、插件和用量</td></tr>
|
||||
<tr><td><b>用户</b></td><td>nonroot(uid 65532)</td></tr>
|
||||
@@ -216,7 +216,7 @@ docker logs magpie</pre>
|
||||
<ul>
|
||||
<li><b>健康检查。</b>镜像带 <code>HEALTHCHECK</code>:网关能应答时 <code>magpie healthcheck</code> 返回 0,<code>serve</code> 和 <code>web</code> 都一样,所以 <code>docker ps</code> 会显示 healthy,Compose 可以用 <code>depends_on: condition: service_healthy</code> 等它。</li>
|
||||
<li><b>终端。</b><code>docker exec -it magpie bash</code> 或 NAS 面板里的终端会打开一个 shell,<code>magpie</code> 在 PATH 里:<code>magpie providers</code>、<code>magpie models</code>、<code>magpie usage</code>、<code>magpie quota</code> 以及其他 <a href="https://github.com/yetone/magpie/blob/main/docs/reference.md">CLI 命令</a>。</li>
|
||||
<li><b>更新。</b>拉取新镜像,在同一个数据卷上重新创建容器:<code>docker pull ghcr.io/yetone/magpie:latest</code>,然后 <code>docker rm -f magpie</code> 再执行同样的 <code>docker run</code>;或 <code>docker compose pull && docker compose up -d</code>。</li>
|
||||
<li><b>更新。</b>拉取新镜像,在同一个数据卷上重新创建容器:<code>docker pull ghcr.io/yetone/magpie:latest</code>,然后 <code>docker rm -f magpie</code> 再执行同样的 <code>docker run</code>;或 <code>docker compose pull && docker compose up -d</code>。magpie 一天会发好几个版本;用 Renovate 或 Watchtower 想一天只更新一次,就跟 <code>daily</code>(Renovate 请固定它的 digest),想一周一次就跟 <code>stable</code>。</li>
|
||||
<li><b>自己构建。</b>在<a href="https://github.com/yetone/magpie">仓库</a>的检出目录里 <code>docker build -t magpie .</code> 得到同样的镜像。</li>
|
||||
</ul>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user