- 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 严格对齐
25 lines
908 B
Bash
Executable File
25 lines
908 B
Bash
Executable File
#!/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}}"
|