mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-02 12:01:50 +08:00
- Add Docker sandbox manager, non-root sandbox image, compose isolation, and host firewall script (#217) - Route Bash, custom commands/scripts, stdio MCP, chat sessions, MainAgent chat, and task-scoped reporter screenshots into sandbox containers with per-task browser concurrency gate - Enforce proxy SSRF guard against loopback, metadata, internal services, and admin port - Add dedicated /system/sandbox management page, /chat session sandbox control, and task detail sandbox popover with progressive stats loading
47 lines
2.0 KiB
Docker
47 lines
2.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
#
|
|
# ARTEX Worker / Chat Sandbox 镜像:
|
|
# 承载所有不受信任的工具执行(Bash / Python 脚本 / 扫描工具 / Playwright 浏览器),
|
|
# 不含 ARTEX 主服务、不含 LLM Key、不含数据库凭据,以非 root 用户运行。
|
|
#
|
|
# 本地构建:
|
|
# docker build -f Dockerfile.sandbox -t ruoji6/artex-sandbox:latest .
|
|
FROM python:3.12-slim-bookworm
|
|
|
|
ENV TZ=Asia/Shanghai \
|
|
DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates ripgrep curl wget vim git jq unzip \
|
|
tzdata procps \
|
|
dnsutils iputils-ping netcat-openbsd inetutils-telnet whois nmap \
|
|
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
&& apt-get install -y --no-install-recommends nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 预装 Playwright MCP 与 CLI 及 Chromium(直接装到全局路径供非 root 用户运行,
|
|
# 浏览器访问目标站点完全隔离在沙箱容器内)。
|
|
# 国内构建可传 --build-arg PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright 加速。
|
|
ARG PLAYWRIGHT_DOWNLOAD_HOST=""
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
|
PLAYWRIGHT_DOWNLOAD_HOST=${PLAYWRIGHT_DOWNLOAD_HOST}
|
|
RUN mkdir -p /ms-playwright /workspace /etc/artex \
|
|
&& npm install -g @playwright/mcp@latest @playwright/cli@latest \
|
|
&& playwright-mcp --version \
|
|
&& playwright-cli --help \
|
|
&& playwright-mcp install-browser --with-deps chromium \
|
|
&& playwright-cli install-browser chromium \
|
|
&& chmod -R a+rX /ms-playwright \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
# 常用渗透/脚本 Python 依赖
|
|
RUN pip install --no-cache-dir requests httpx beautifulsoup4 pyyaml
|
|
|
|
# 非 root 运行用户(UID/GID 1000,与 ARTEX_SANDBOX_USER 默认值对齐)。
|
|
RUN groupadd -g 1000 sandbox \
|
|
&& useradd -u 1000 -g 1000 -m -s /bin/bash sandbox \
|
|
&& chown -R 1000:1000 /workspace
|
|
|
|
USER 1000:1000
|
|
WORKDIR /workspace
|
|
CMD ["sleep", "infinity"]
|