Bootstrap a working Docker Compose config on first boot so the WebUI works out of the box

A fresh 'docker compose up' started with no config (the entrypoint only
bootstrapped for Render), so every published port was unreachable: the
gateway and WebSocket channel defaulted to a container-local 127.0.0.1
bind, and nanobot-api exited into a restart loop because serve refuses a
non-loopback host without an api_key.

Bootstrap config.json for container runs (NANOBOT_DOCKER_BOOTSTRAP, set
by docker-compose.yml) from a committed docker-config.json with binds
that survive the container boundary, baking the WebUI token and API key
at first boot (env value if provided, generated otherwise, printed to
the log). Move nanobot-api under the 'api' profile since it cannot
serve before a provider is configured. Install curl in the image and
document the new first-boot flow.

Fixes #6165
This commit is contained in:
LuckVd authored and chengyongru committed 2026-10-19 13:02:26 +08:00
1 parent 53e0edf709
commit ddd22a26f8
6 files changed
+153 -14

No files matched your search

+6 -1
View File
@@ -12,7 +12,7 @@ RUN mkdir -p /app/nanobot/web && npm run build
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates git bubblewrap openssh-client libmagic1 && \
apt-get install -y --no-install-recommends ca-certificates curl git bubblewrap openssh-client libmagic1 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
@@ -54,6 +54,11 @@ RUN for channel in $(printf '%s' "$NANOBOT_CHANNELS" | tr ',' ' '); do \
# won't shadow it. Only used when RENDER=true; ignored by local runs.
COPY render-config.json ./
# Local Docker deploy template (see docker-compose.yml): container-appropriate
# binds with the WebUI token and API key baked in by the entrypoint at first
# boot. Same /app location so a mounted data dir can't shadow it.
COPY docker-config.json ./
# Create the non-root user and hand ownership of the writable virtualenv to it.
RUN useradd -m -u 1000 -s /bin/bash nanobot && \
mkdir -p /home/nanobot/.nanobot && \