refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries
This commit is contained in:
1 parent
3f1c6d02f6
commit
27c0f27434
268 files changed
+7468
-7852
No files matched your search
+13
-13
@@ -1,6 +1,6 @@
|
||||
# 单容器镜像:一个 deno compile 出的 umt-server 二进制,同时承担 API(含 web 静态 SPA)与 worker。
|
||||
# 单容器镜像:一个 bun build --compile 出的 umt-server 二进制,同时承担 API(含 web 静态 SPA)与 worker。
|
||||
# PostgreSQL 不在本镜像内,见 docker-compose.yml。
|
||||
# 构建:docker build -t uhd-media-tool . 运行时版本锁定 Deno 2.9.7(ADR-004)
|
||||
# 构建:docker build -t uhd-media-tool . 运行时版本锁定 Bun 1.4.3(ADR-007)
|
||||
# ffprobe 取自静态构建镜像(单个 static-pie 二进制,约 135 MB;Debian 的 ffmpeg 包要拉 200+ 个依赖、约 450 MB)
|
||||
ARG FFPROBE_IMAGE=mwader/static-ffmpeg:9.0.2@sha256:7d9bdaaf887f7e6ce6151f67325c344074b5ff1fb75316011c3376503e449a7b
|
||||
FROM ${FFPROBE_IMAGE} AS ffprobe
|
||||
@@ -8,29 +8,27 @@ FROM ${FFPROBE_IMAGE} AS ffprobe
|
||||
# 与 PG 18 服务端同主版本的备份工具,避免 Debian 默认 17 客户端拒绝导出 PG 18。
|
||||
FROM postgres:18.6-trixie@sha256:5a5a84b19854a9ffaa54082c166ff4ec27473a361e496e5ea167f298f2da9722 AS postgres-tools
|
||||
|
||||
FROM denoland/deno:2.9.7@sha256:fa335acdf6b72106eda2cb6a8cb5f4187e7630e357467489db4b2e7352d5e432 AS build
|
||||
FROM oven/bun:1.4.3 AS build
|
||||
ARG APT_MIRROR=""
|
||||
RUN if [ -n "$APT_MIRROR" ]; then sed -i "s|deb.debian.org|$APT_MIRROR|g" /etc/apt/sources.list.d/debian.sources; fi \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends build-essential libnode-dev && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
RUN deno install --frozen
|
||||
RUN bun install --frozen-lockfile
|
||||
ARG APP_VERSION=""
|
||||
ENV APP_VERSION=${APP_VERSION}
|
||||
RUN deno task check:tokens && cd apps/web && deno task build
|
||||
# --node-modules-dir=none + --exclude-unused-npm:只嵌入 server 依赖图可达的 npm 包(约 110 MB,而不是整个 node_modules)
|
||||
# 权限在编译时固定:读写不限路径(库根/下载目录由用户挂载,位置不固定;写保护靠 /app root 只读 + 非 root 运行);
|
||||
# --allow-run 只放 ffprobe(入库探测)、sha256sum(强制全量哈希走子进程,coreutils 自带)与 /app/umt-server 自身
|
||||
# (fsproxy 把单个文件操作放进 `umt-server --role fsworker` 一次性子进程,挂死可 SIGKILL 回收;二进制必须装在 /app/umt-server)
|
||||
# 编译后立即自检:空环境跑 --role preflight,模块图缺件(ERR_MODULE_NOT_FOUND)在构建期就失败,不留到容器启动
|
||||
RUN cd apps/server && deno task compile && cd /src && sh scripts/check-compiled-binary.sh
|
||||
RUN bun run check:tokens && cd apps/web && bun run build
|
||||
RUN cd apps/server && bun run compile && cd /src && sh scripts/check-compiled-binary.sh
|
||||
|
||||
FROM debian:trixie-slim@sha256:a99cfc517144bc59b1978475ec53b46ecabec7e43635402ee5b77cc54cd1b20a
|
||||
# gosu 用于降权;PG 18 客户端来自固定的官方同发行版镜像,这里只安装动态库。
|
||||
# Deno 自带根证书;健康探测用二进制自身的 fetch。
|
||||
# 安装系统根证书;健康探测用二进制自身的 fetch。
|
||||
# 国内网络可 --build-arg APT_MIRROR=mirrors.ustc.edu.cn 换源
|
||||
ARG APT_MIRROR=""
|
||||
RUN if [ -n "$APT_MIRROR" ]; then sed -i "s|deb.debian.org|$APT_MIRROR|g" /etc/apt/sources.list.d/debian.sources; fi \
|
||||
&& apt-get update \
|
||||
&& apt-get upgrade -y --no-install-recommends \
|
||||
&& apt-get install -y --no-install-recommends gosu libssl3t64 libgssapi-krb5-2 libldap2 libzstd1 liblz4-1 libreadline8t64 \
|
||||
&& apt-get install -y --no-install-recommends gosu ca-certificates libssl3t64 libgssapi-krb5-2 libldap2 libzstd1 liblz4-1 libreadline8t64 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd --system --gid 10001 umt \
|
||||
&& useradd --system --uid 10001 --gid 10001 --home-dir /data --no-create-home --shell /usr/sbin/nologin umt \
|
||||
@@ -42,6 +40,8 @@ RUN ldconfig && pg_dump --version && pg_restore --version && psql --version
|
||||
# /app 全部 root 属主、只读:运行用户(缺省 10001,可用 PUID/PGID 覆盖)改不了二进制与静态产物
|
||||
COPY --from=ffprobe --chown=root:root --chmod=0555 /ffprobe /usr/local/bin/ffprobe
|
||||
COPY --from=build --chown=root:root --chmod=0555 /src/dist/umt-server /app/umt-server
|
||||
COPY --from=build --chown=root:root /src/dist/sandbox-policy.node /app/sandbox-policy.node
|
||||
COPY --from=build --chown=root:root /src/dist/skills /app/skills
|
||||
COPY --from=build --chown=root:root /src/apps/web/build/client /app/public
|
||||
COPY --chown=root:root --chmod=0555 docker/entrypoint.sh /app/entrypoint.sh
|
||||
COPY --chown=root:root --chmod=0555 scripts/backup.sh scripts/restore.sh /app/scripts/
|
||||
|
||||
Reference in new issue
Block a user