yggdrasil/docker/build-runners.sh
xfy 9851f98dc0 chore(docker): setup sandboxed runtime containers and build script
- runner-base: alpine 3.18 + 非 root 用户 1000:1000 + /code 工作目录
- runner-python: 基于 base, apk add python3 + python 符号链接(对齐 run_cmd 'python')
- runner-node: 基于 base, apk add nodejs
- runner.toml: 镜像自描述(运行时实际配置由 Rust LANGUAGES 注册表 + 环境变量决定)
- build-runners.sh: 按 base→python→node 顺序构建, tag 与 languages.rs 严格对齐
2026-07-03 18:48:03 +08:00

25 lines
908 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# 构建代码运行器所需的沙箱镜像base → python / node。
#
# 依赖:本机已安装 docker。构建顺序固定python/node FROM base
# 镜像 tag 与 src/api/code_runner/languages.rs 的注册项严格对应:
# yggdrasil-runner-base:latest
# yggdrasil-runner-python:latest
# yggdrasil-runner-node:latest
set -e
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
echo "==> Building yggdrasil-runner-base:latest"
docker build -t yggdrasil-runner-base:latest "$SCRIPT_DIR/runner-base"
echo "==> Building yggdrasil-runner-python:latest"
docker build -t yggdrasil-runner-python:latest "$SCRIPT_DIR/runner-python"
echo "==> Building yggdrasil-runner-node:latest"
docker build -t yggdrasil-runner-node:latest "$SCRIPT_DIR/runner-node"
echo "==> Done. Images:"
docker images --filter "reference=yggdrasil-runner-*" \
--format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"