Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
# TARGETARCH. Only the final stage runs as the target (emulated for arm64 on an
# amd64 builder), which keeps multi-platform releases fast.
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS chatbot
# Optional npm registry, e.g. https://registry.npmmirror.com. Empty keeps npm's
# default; builds behind a mirror set it through compose/start.sh.
ARG NPM_REGISTRY=
WORKDIR /src
COPY chatbot/package.json chatbot/package-lock.json chatbot/
RUN --mount=type=cache,target=/root/.npm npm --prefix chatbot ci --include=dev --no-audit --no-fund
RUN --mount=type=cache,target=/root/.npm npm --prefix chatbot ci --include=dev --no-audit --no-fund ${NPM_REGISTRY:+--registry="$NPM_REGISTRY"}
COPY chatbot/ chatbot/
COPY web/app/ web/app/
RUN npm --prefix chatbot run build && test -f web/native-chat/index.html
FROM --platform=$BUILDPLATFORM golang:1.26.11-bookworm AS build
ARG TARGETOS
ARG TARGETARCH
# Optional Go module proxy, e.g. https://goproxy.cn. Empty keeps Go's default.
ARG GOPROXY=
ENV GOPROXY=${GOPROXY}
WORKDIR /src
# Empty lets build-binaries.sh size parallelism from the builder's CPUs and memory.
ARG LOOPFORGE_BUILD_JOBS=
Expand All @@ -28,9 +34,10 @@ RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache
COPY --from=chatbot /src/web/native-chat/ web/native-chat/
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build GOOS=${TARGETOS} GOARCH=${TARGETARCH} bash scripts/build-binaries.sh --platform /out
FROM node:22-bookworm
ARG NPM_REGISTRY=
RUN --mount=type=cache,target=/root/.npm apt-get update && apt-get install -y --no-install-recommends ca-certificates git openssh-client bash curl python3 ripgrep \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g @openai/codex@0.162.1 @tencent-ai/codebuddy-code@2.167.0 @deepseek-ai/dsh@0.2.2-rc.1
&& npm install -g ${NPM_REGISTRY:+--registry="$NPM_REGISTRY"} @openai/codex@0.162.1 @tencent-ai/codebuddy-code@2.167.0 @deepseek-ai/dsh@0.2.2-rc.1
# A relocatable Python that sandboxes of images without python3 mount for the
# native CLI hooks (internal/runtime/toolchain.go). Its terminfo database has
# names differing only in case, which a case-insensitive data directory (macOS)
Expand Down
2 changes: 2 additions & 0 deletions compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ services:
args:
LOOPFORGE_BUILD_JOBS: ${LOOPFORGE_BUILD_JOBS:-}
LOOPFORGE_COMMIT: ${LOOPFORGE_COMMIT:-}
NPM_REGISTRY: ${NPM_REGISTRY:-}
GOPROXY: ${GOPROXY:-}
environment:
AGENTFLOW_ISOLATED_IMAGE: loopforge-platform:local
3 changes: 3 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ Use `AGENTFLOW_MYSQL_DSN` for your own MySQL deployment. A fresh account command
./start.sh pull # refresh images and recreate changed containers
MIRROR=ghcr.nju.edu.cn ./start.sh # same install; replace the ghcr.io host with this registry
./start.sh dev # build this checkout instead (compose.dev.yaml)
NPM_REGISTRY=https://registry.npmmirror.com ./start.sh dev # source build behind an npm mirror
./start.sh release # switch a source build back to the published image
```

`start.sh dev` builds the chatbot bundle and the platform image in Docker. On networks where the container cannot reach `registry.npmjs.org`, set `NPM_REGISTRY` (environment or `.env`) to a reachable npm registry; it is passed to both the chatbot and the runtime `npm install -g` steps. Likewise set `GOPROXY` (for example `https://goproxy.cn`) when `proxy.golang.org` is unreachable. Empty keeps each tool's default. `MIRROR` only redirects GHCR image pulls and does not affect npm or Go modules.

The installer checks Docker, Compose, Python 3 and curl. It offers to install missing Python/curl packages using apt, dnf or yum on Linux (Homebrew on macOS), Docker using its official installer, and the missing Linux x86_64/arm64 Compose plugin using the pinned official release with SHA-256 verification. A plugin is installed for the active Docker user, or system-wide when Docker requires sudo. macOS Compose comes from Docker Desktop. Set `LOOPFORGE_YES=1` to accept installation prompts; internet access and package-manager/administrator permissions are still required. The installer generates `.env` with unique secrets, pulls and starts the containers, installs the observability columns and applies `migrations/seed/*.sql`. It is safe to re-run. Set `AGENTFLOW_HTTP_PORT` or `LOOPFORGE_MYSQL_PORT` in the environment before the first run (or edit `.env` later) when the default ports are taken.

Run it as the installation owner, including an ordinary Linux user. If that user cannot access Docker directly, the installer validates sudo and uses `sudo -n docker` consistently for Compose, schema installation and seeds. Before each operation it checks whether sudo credentials expired during a long build, prompting again in a terminal or failing with instructions in unattended mode. It does not require adding the user to the Docker group or logging out. For unattended installations run `sudo -v` first; `LOOPFORGE_YES=1` accepts installation prompts but does not bypass operating-system permissions. Without sudo or Docker access it fails immediately with instructions. Rootless Docker uses its active context's Unix socket; remote Docker contexts need a separately configured deployment because sandbox workspaces are local bind mounts.
Expand Down
2 changes: 2 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# ./start.sh release switch a source-built installation back to GHCR
# MIRROR=ghcr.nju.edu.cn ./start.sh
# pull ghcr.io images from that host and tag them back
# NPM_REGISTRY=https://registry.npmmirror.com ./start.sh dev
# build this checkout with that npm registry
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
source scripts/docker-access.sh
Expand Down