- Sidebar: three status LEDs (server, models, MCP) with an overview popover (/api/status) - Images: preview stage, purpose-based model choice and reference images (Nano Banana Pro edit refines the chosen preview) - Settings: restore a stored or uploaded backup (staged, applied on restart) - Provider form: test connection; saving or reloading re-checks the status at once - opencode Zen/Go: send x-opencode-session with a stable id per conversation - Releases are named vYYYYMM-NNNNN; scripts/release.sh numbers, tags, builds and publishes - Fix: backups made in the same second no longer overwrite each other Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
4.2 KiB
Docker
91 lines
4.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# Multi-arch: the web UI and the server are built once on the build
|
|
# machine (cross-compiled with cargo-zigbuild); only the runtime stage runs
|
|
# per target platform.
|
|
|
|
# --- web UI (PWA) -------------------------------------------------------------
|
|
FROM --platform=$BUILDPLATFORM node:22-alpine AS web
|
|
WORKDIR /web
|
|
COPY web/package.json web/package-lock.json ./
|
|
RUN npm ci --no-audit --no-fund
|
|
COPY web/ ./
|
|
RUN npm run build
|
|
|
|
# --- Rust toolchain with zig for cross-compiling --------------------------------
|
|
FROM --platform=$BUILDPLATFORM rust:1-bookworm AS toolchain
|
|
RUN apt-get update && apt-get install -y --no-install-recommends cmake xz-utils && rm -rf /var/lib/apt/lists/*
|
|
ARG ZIG_VERSION=0.17.1
|
|
RUN curl -fsSL https://ziglang.org/download/${ZIG_VERSION}/zig-$(uname -m)-linux-${ZIG_VERSION}.tar.xz | tar -xJ -C /opt \
|
|
&& ln -s /opt/zig-*/zig /usr/local/bin/zig \
|
|
&& cargo install --locked cargo-zigbuild \
|
|
&& rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
|
|
WORKDIR /src
|
|
|
|
# --- server (for the target platform, glibc of Debian bookworm) ----------------
|
|
FROM toolchain AS server
|
|
ARG TARGETARCH
|
|
RUN case "$TARGETARCH" in \
|
|
amd64) echo x86_64-unknown-linux-gnu ;; \
|
|
arm64) echo aarch64-unknown-linux-gnu ;; \
|
|
*) echo "unsupported architecture $TARGETARCH" >&2; exit 1 ;; \
|
|
esac > /target
|
|
COPY config.example.toml ./
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY core/Cargo.toml ./core/
|
|
COPY server/Cargo.toml ./server/
|
|
COPY cli/Cargo.toml ./cli/
|
|
# Cache dependencies separately from the sources (stub crates first).
|
|
RUN mkdir -p core/src server/src cli/src \
|
|
&& echo '' > core/src/lib.rs && echo 'fn main(){}' > server/src/main.rs && echo 'fn main(){}' > cli/src/main.rs \
|
|
&& cargo zigbuild --release -p codecraft --target "$(cat /target).2.36" && rm -rf core/src server/src cli/src
|
|
COPY core/src ./core/src
|
|
COPY server/src ./server/src
|
|
COPY server/resources-cli ./server/resources-cli
|
|
COPY cli/src ./cli/src
|
|
ARG GIT_COMMIT=""
|
|
ENV CODECRAFT_COMMIT=${GIT_COMMIT}
|
|
# Release version (YYYYMM-NNNNN, set by scripts/release.sh); empty = development build.
|
|
ARG CODECRAFT_VERSION=""
|
|
ENV CODECRAFT_VERSION=${CODECRAFT_VERSION}
|
|
RUN touch core/src/lib.rs server/src/main.rs \
|
|
&& cargo zigbuild --release -p codecraft --target "$(cat /target).2.36" \
|
|
&& cp "target/$(cat /target)/release/codecraft" /codecraft
|
|
|
|
# --- runtime ------------------------------------------------------------------
|
|
# Node is included so agents can work on JS projects and run npx-based MCP servers.
|
|
FROM node:22-bookworm-slim
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates bash git curl wget ripgrep jq less procps file bubblewrap \
|
|
unzip zip xz-utils bzip2 p7zip-full unar innoextract unshield cabextract msitools arj lhasa \
|
|
python3 python3-pip python3-venv pipx \
|
|
build-essential pkg-config libssl-dev cmake zlib1g-dev binutils-multiarch \
|
|
chromium fonts-dejavu-core fonts-noto-color-emoji poppler-utils openmpt123 \
|
|
openscad xvfb xauth \
|
|
openssh-client rsync mc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
# Language servers for diagnostics after edits (rust-analyzer/gopls/clangd can be
|
|
# installed by agents: rustup component add rust-analyzer, go install …).
|
|
RUN npm install -g typescript@5 typescript-language-server pyright && npm cache clean --force
|
|
COPY --from=server /codecraft /usr/local/bin/codecraft
|
|
COPY --from=web /web/dist /app/web
|
|
COPY server/ghidra /app/ghidra
|
|
COPY server/resources /app/resources
|
|
# The agent's home lives on the data volume: tools it installs in user space
|
|
# (pip --user, pipx, rustup, npm -g, downloaded binaries) survive rebuilds.
|
|
ENV CODECRAFT_WEB=/app/web \
|
|
CODECRAFT_CONFIG=/data/config.toml \
|
|
HOME=/data/home \
|
|
PATH=/data/home/.local/bin:/data/home/.cargo/bin:/data/home/.npm-global/bin:/usr/local/bin:/usr/bin:/bin \
|
|
NPM_CONFIG_PREFIX=/data/home/.npm-global \
|
|
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
|
PIPX_HOME=/data/home/.local/pipx \
|
|
PIPX_BIN_DIR=/data/home/.local/bin \
|
|
RUST_LOG=info
|
|
RUN mkdir -p /data /workspace && chmod 777 /data /workspace
|
|
VOLUME ["/data"]
|
|
EXPOSE 8787
|
|
# Run as the host user (see docker-compose.yml) so files in /workspace keep their owner.
|
|
USER 1000:1000
|
|
ENTRYPOINT ["codecraft"]
|