mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-03 04:11:51 +08:00
- Add standalone edition (`Dockerfile.standalone`, `docker-compose.standalone.yml`) alongside sandbox edition and publish both in `.github/workflows/release.yml`. - Implement `scripts/deploy-lib.sh`, `install.sh`, `update.sh`, and `scripts/artex-sandbox-firewall.sh --cleanup` with edition detection, legacy standalone -> sandbox migration (symlink-safe workspace permissions), automatic snapshots with pinned `artex-rollback/*` images + PG dump, auto/manual cross-edition rollback, and post-rollback upstream unpinning. - Update `ensureWritableDir` in `internal/sandbox/manager.go` to safely migrate nested root-owned workspace files without following symlinks. - Expose `deploy_edition` in `/api/update/check` and update `UpdateCard` UI/i18n warnings for sandbox vs standalone in-app update/rollback. - Reconcile `artex-gateway` TUN policy routing (`priority 218`, `raw PREROUTING`, `nat POSTROUTING`, `DOCKER-USER`) every 15s to self-heal after host network rule flushes or bridge changes. - Add unit and shell tests (`scripts/deploy_test.sh`, `cmd/artex-gateway/tun_linux_test.go`, `internal/sandbox/sandbox_test.go`, `server/update_test.go`) and update `README.md` / `.env.example`.
62 lines
2.7 KiB
Docker
62 lines
2.7 KiB
Docker
# syntax=docker/dockerfile:1
|
||
#
|
||
# 单容器全功能镜像(Standalone 版,兼容上一版本单容器部署形态):
|
||
# 在一个容器内同时包含 ARTEX 主程序、Python 3.12、Node 22、Playwright/Chromium
|
||
# 与常用渗透工具链(nmap / ripgrep / curl / dnsutils / netcat 等),以
|
||
# ARTEX_SANDBOX_MODE=local 运行,无需 docker-socket-proxy、/dev/net/tun 或
|
||
# CAP_NET_ADMIN 透明网关容器。
|
||
#
|
||
# 本地手动构建镜像时,先自行准备二进制:
|
||
# cd web && npm run build:static && cd ..
|
||
# rm -rf server/webui/dist && cp -r web/out server/webui/dist
|
||
# CGO_ENABLED=0 GOARCH=amd64 go build -tags embedui -o dist/amd64/artex ./cmd/artex
|
||
# docker build -f Dockerfile.standalone -t ruoji6/artex:standalone .
|
||
FROM python:3.12-slim-bookworm
|
||
ARG TARGETARCH
|
||
ARG APT_MIRROR=""
|
||
ARG NPM_REGISTRY=""
|
||
ARG PIP_INDEX_URL=""
|
||
ARG PLAYWRIGHT_DOWNLOAD_HOST=""
|
||
|
||
ENV TZ=Asia/Shanghai \
|
||
DEBIAN_FRONTEND=noninteractive \
|
||
PLAYWRIGHT_DOWNLOAD_HOST=${PLAYWRIGHT_DOWNLOAD_HOST} \
|
||
ARTEX_SANDBOX_MODE=local
|
||
|
||
RUN if [ -n "$APT_MIRROR" ]; then \
|
||
sed -i "s|deb.debian.org|${APT_MIRROR}|g; s|security.debian.org|${APT_MIRROR}|g" /etc/apt/sources.list.d/debian.sources 2>/dev/null || true; \
|
||
fi \
|
||
&& 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(全局),运行时优先直接调用 playwright-mcp,无需 npx 联网下载。
|
||
RUN npm install -g ${NPM_REGISTRY:+--registry="$NPM_REGISTRY"} @playwright/mcp@latest @playwright/cli@latest \
|
||
&& playwright-mcp --version \
|
||
&& playwright-cli --help \
|
||
&& playwright-mcp install-browser --with-deps chromium \
|
||
&& playwright-cli install-browser chromium \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
RUN if [ -n "$PIP_INDEX_URL" ]; then \
|
||
pip install --no-cache-dir -i "$PIP_INDEX_URL" requests httpx beautifulsoup4 pyyaml; \
|
||
else \
|
||
pip install --no-cache-dir requests httpx beautifulsoup4 pyyaml; \
|
||
fi
|
||
WORKDIR /app
|
||
# 预编译好的对应架构二进制(dist/amd64/artex 或 dist/arm64/artex)
|
||
COPY dist/${TARGETARCH}/artex /app/artex
|
||
# 守护启动脚本:进程退出后按退出码决定是否重新拉起,页面一键更新与回滚靠它完成换装。
|
||
COPY start.sh /app/start.sh
|
||
RUN chmod +x /app/artex /app/start.sh
|
||
COPY skills/ /app/skills/
|
||
# data/(SQLite + jwt.key)持久化点
|
||
VOLUME ["/app/data"]
|
||
EXPOSE 8787 8788
|
||
ENTRYPOINT ["/app/start.sh"]
|
||
CMD ["-addr", ":8787", "-proxy", ":8788"]
|