fix: replace vulnerable container bases and release v0.1.21
This commit is contained in:
+18
-38
@@ -2,50 +2,30 @@
|
||||
|
||||
### Build networking and cache
|
||||
|
||||
The Dockerfile retains the pinned Python base, locked Python dependencies,
|
||||
`fonts-noto-cjk`, Debian repository signature checks, and offline artifact
|
||||
SHA256 verification. Production uses `scripts/build-verify.sh`; CI uses `scripts/ci-compose-verify.py`.
|
||||
Both build the same Dockerfile with BuildKit and retain `docker compose build --pull`.
|
||||
The runtime uses an official Python 3.14 Alpine 3.24 image pinned by digest,
|
||||
locked Python dependencies, and `font-noto-cjk` for Chinese rendering. APK
|
||||
repository signatures and offline wheel SHA256 checks remain enabled.
|
||||
Production uses `scripts/build-verify.sh`; CI uses `scripts/ci-compose-verify.py`.
|
||||
Both build the same Dockerfile with BuildKit and `docker compose build --pull`.
|
||||
|
||||
APT mirror hosts are configurable through `DEBIAN_MIRROR` and
|
||||
`DEBIAN_SECURITY_MIRROR` (hosts only, without scheme or path). Defaults are
|
||||
`deb.debian.org`; HTTPS is used for both Debian and security repositories.
|
||||
For mainland-China NAS builds, use the shared profile:
|
||||
`ALPINE_MIRROR` accepts a mirror host (without scheme or path), defaulting to
|
||||
`dl-cdn.alpinelinux.org`. For mainland-China builds:
|
||||
|
||||
```sh
|
||||
. ./deploy/build-cn.env
|
||||
./scripts/build-verify.sh
|
||||
```
|
||||
|
||||
CI loads this same profile, using Tsinghua TUNA for both repositories unless
|
||||
Gitea repository variables `DEBIAN_MIRROR` / `DEBIAN_SECURITY_MIRROR` override
|
||||
it. Production may also set the two hosts directly in `.env` when calling the
|
||||
build script without the profile. An alternate mainland mirror is
|
||||
`mirrors.ustc.edu.cn`; availability and throughput depend on the Runner network.
|
||||
No fallback disables signature verification or removes packages.
|
||||
CI uses this profile; the Gitea `ALPINE_MIRROR` repository variable can override
|
||||
it. APK upgrades available packages during a fresh dependency-layer build.
|
||||
Use `docker compose build --pull --no-cache` to refresh OS packages explicitly.
|
||||
|
||||
Layer order stays: pinned base → APT/font dependencies → `requirements.lock`
|
||||
→ pip dependencies → application/vendor source → build metadata.
|
||||
A source-only change therefore reuses the APT and pip layers, provided the
|
||||
same builder, base digest, mirror arguments, and optional offline artifacts
|
||||
are used. Changing the lockfile rebuilds pip and later layers, not APT.
|
||||
Changing the mirror or APT instructions rebuilds APT and later layers.
|
||||
|
||||
Previously an APT layer miss redownloaded indexes/packages, and pip used
|
||||
`--no-cache-dir`. Now locked BuildKit mounts retain APT indexes, downloaded
|
||||
`.deb` files, and pip downloads/wheels outside the final image. Debian's
|
||||
`docker-clean` hook is disabled so it cannot discard cached packages.
|
||||
Re-executed APT steps still run `apt-get update` and validate repository
|
||||
signatures; cached packages and pip artifacts can avoid repeat large downloads.
|
||||
The initial build after this Dockerfile change will miss dependency layers;
|
||||
subsequent builds benefit. No measured speedup is claimed before CI completes.
|
||||
|
||||
Caches belong to the Docker builder, not the ephemeral CI workspace. Keep the
|
||||
NAS Runner's builder storage across jobs; removing the builder, pruning caches,
|
||||
or using a fresh Docker daemon loses the benefit. Cache mounts are disposable:
|
||||
an empty cache still builds correctly. `--pull` remains enabled; a pinned base
|
||||
digest check alone does not invalidate dependency layers. To deliberately
|
||||
refresh installed APT versions, use `docker compose build --pull --no-cache`.
|
||||
Layer order is pinned base → APK/fonts → requirements → Python dependencies
|
||||
→ application source → metadata. BuildKit caches pip downloads separately for
|
||||
musl and architecture. Optional `build-cache/wheels/` must contain compatible
|
||||
musllinux wheels and their SHA256 manifest; empty-cache builds work normally.
|
||||
Do not reuse Debian/manylinux wheels on Alpine. Caches are disposable builder
|
||||
resources and are not runtime mounts or dependencies.
|
||||
|
||||
### CI with a host Docker socket
|
||||
|
||||
@@ -94,8 +74,8 @@ certificate environment settings, and proxy settings remain in effect.
|
||||
These `CI_PIP_*` settings apply only to the Job's pip install. They are not
|
||||
passed into Docker build arguments or persisted into the production image.
|
||||
The Dockerfile keeps its own cached/offline dependency installation and logs
|
||||
the Docker pip index host for online installs. Debian mirror variables affect
|
||||
APT only and are loaded later in the Docker verification step.
|
||||
the Docker pip index host for online installs. The Alpine mirror variable affects
|
||||
APK only and are loaded later in the Docker verification step.
|
||||
|
||||
If dependency installation fails, the always() cleanup step still executes.
|
||||
It skips the Python/PyYAML cleanup script when no CI Compose manifest exists,
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ A failed mirror installation retries the same locked requirements against the
|
||||
fallback, without extra indexes, version downgrades, or disabling build isolation.
|
||||
Logs show index hosts and redact URL credentials/query parameters.
|
||||
|
||||
APT/font layers remain cached when Python dependencies change. The Python layer
|
||||
APK/font layers remain cached when Python dependencies change. The Python layer
|
||||
changes only when the lock, installer, base image, or mirror arguments change;
|
||||
application source changes reuse it. BuildKit pip cache survives layer misses.
|
||||
An explicitly supplied, checksum-verified offline wheel directory still takes
|
||||
|
||||
+4
-8
@@ -128,23 +128,19 @@ all uncompressed rootfs diff IDs before loading. With the verified local tag loa
|
||||
|
||||
```sh
|
||||
sudo env DOCKER_BUILDKIT=1 /usr/local/bin/docker compose build \
|
||||
--build-arg PYTHON_BASE=python:3.14.5-slim-bookworm
|
||||
--build-arg PYTHON_BASE=python:3.14.8-alpine3.24
|
||||
```
|
||||
|
||||
This per-build override does not change global registry or network configuration.
|
||||
|
||||
A slow Debian CDN can be overridden only for this build, retaining APT GPG
|
||||
A slow Alpine CDN can be overridden for this build, retaining APK signature
|
||||
verification and changing no NAS system settings:
|
||||
|
||||
```sh
|
||||
sudo /usr/local/bin/docker compose build --build-arg DEBIAN_MIRROR=mirrors.aliyun.com
|
||||
sudo /usr/local/bin/docker compose build --build-arg ALPINE_MIRROR=mirrors.tuna.tsinghua.edu.cn
|
||||
```
|
||||
|
||||
Optional `build-cache/debs/fonts-noto-cjk.deb` avoids a slow build-network download.
|
||||
Dockerfile verifies it against SHA-256 from the GPG-authenticated APT index before use.
|
||||
The cache is not a runtime mount or committed dependency, and empty-cache builds work.
|
||||
|
||||
Optional `build-cache/wheels/` can hold all 24 Linux AMD64/Python 3.14 wheels
|
||||
Optional `build-cache/wheels/` can hold all locked Linux AMD64/Python 3.14 musllinux wheels
|
||||
and `SHA256SUMS`, verified against official PyPI release metadata. Builds verify
|
||||
the manifest and use pip `--no-index`; incomplete caches fail explicitly.
|
||||
Build commit/time are set after dependency installation to preserve build cache.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
FRAME_FLOW_IMAGE='<已验证的镜像标签>' docker compose -f deploy/compose.ubuntu-photos-api.yml config --quiet
|
||||
```
|
||||
|
||||
完整构建使用根目录 Dockerfile。若使用 `deploy/Dockerfile.runtime-update`,必须指定已审核的基础镜像,构建步骤会检查依赖锁与基础镜像相同;不相同时必须完整构建。本次依赖未新增,已比对现有 0.1.8 基础镜像的锁文件。
|
||||
发布统一使用根目录 Dockerfile 完整构建,包含固定基础映像、系统安全更新和锁定依赖,避免继承旧映像中的系统漏洞。
|
||||
|
||||
## 旧来源转换与恢复
|
||||
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "PIGWay Frame Flow API",
|
||||
"version": "0.1.19"
|
||||
"version": "0.1.21"
|
||||
},
|
||||
"paths": {
|
||||
"/api/v1/devices/{device_id}/widgets/selection": {
|
||||
@@ -15227,7 +15227,7 @@
|
||||
"version": {
|
||||
"type": "string",
|
||||
"title": "Version",
|
||||
"default": "0.1.19"
|
||||
"default": "0.1.21"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
@@ -17490,7 +17490,7 @@
|
||||
"version": {
|
||||
"type": "string",
|
||||
"title": "Version",
|
||||
"default": "0.1.19"
|
||||
"default": "0.1.21"
|
||||
},
|
||||
"api_version": {
|
||||
"type": "string",
|
||||
|
||||
Reference in New Issue
Block a user