You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Toggle the WebUI build during the Docker build step
#6675
In order to keep to nanobot's spirit of a modular, lean agentic harness, it should allow users to completely skip building the WebUI when building a nanobot Docker image. This could simply be achieved by following the existing NANOBOT_SKIP_WEBUI_BUILD environment variable during the build stage too. If the variable is unset, the WebUI would be included in the build by default; otherwise, it would be skipped altogether.
This allows people that use nanobot primarily via provider channels (WhatsApp, Telegram, etc.) and not the WebUI to build a smaller image. Recently, my 2 GiB nanobot VM has been unable to build its nanobot Docker image as the build process now causes it to run out of memory, due to how expensive building the WebUI is now. Skipping this step allows the image build to complete without issue, and much faster.
Here are the changes I'd suggest we could make to the Dockerfile to allow this
# Set to 1 to build an image without the WebUI. Only 0 and 1 are valid because
# the value selects the webui-<value> stage below, so a skipped build never pulls
# the Node image or runs npm.
ARG NANOBOT_SKIP_WEBUI_BUILD=0
FROM node:24-bookworm-slim AS webui-0
WORKDIR /app
COPY webui/package.json webui/package-lock.json ./webui/
WORKDIR /app/webui
RUN npm ci
COPY webui/ ./
COPY packages/client-events/ /app/packages/client-events/
COPY nanobot/channels/ /app/nanobot/channels/
RUN mkdir -p /app/nanobot/web && npm run build
# Provides the empty dist directory the runtime stage copies from. It reuses the
# runtime base image, which is pulled anyway; buildah does not keep an empty
# WORKDIR in a scratch stage.
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS webui-1
RUN mkdir -p /app/nanobot/web/dist
FROM webui-${NANOBOT_SKIP_WEBUI_BUILD} AS webui
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl git bubblewrap openssh-client libmagic1 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Keep the runtime environment writable by the non-root nanobot user. Enabled
# channels may install their manifest-declared dependencies at startup.
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:$PATH"
RUN uv venv --seed "$VIRTUAL_ENV"
ARG NANOBOT_EXTRAS=
COPY pyproject.toml ./
RUN set -- && \
for extra in $(printf '%s' "$NANOBOT_EXTRAS" | tr ',' ' '); do \
set -- "$@" --extra "$extra"; \
done && \
uv pip install --python "$VIRTUAL_ENV/bin/python" --no-cache -r pyproject.toml "$@"
COPY README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./
COPY docs/ docs/
COPY nanobot/ nanobot/
COPY scripts/install_channel_dependencies.py scripts/
COPY --from=webui /app/nanobot/web/dist/ nanobot/web/dist/
RUN NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --python "$VIRTUAL_ENV/bin/python" --no-cache --no-deps .
ARG NANOBOT_CHANNELS=whatsapp
RUN for channel in $(printf '%s' "$NANOBOT_CHANNELS" | tr ',' ' '); do \
python -m scripts.install_channel_dependencies "$channel"; \
done
# Render deploy template (see render.yaml): committed gateway config that wires
# secrets through ${ANTHROPIC_API_KEY} / ${NANOBOT_WEB_TOKEN} env vars (resolved
# at startup). Lives in the code dir (/app), not the data dir, so a mounted disk
# won't shadow it. Only used when RENDER=true; ignored by local runs.
COPY render-config.json ./
RUN useradd -m -u 1000 -s /bin/bash nanobot && \
mkdir -p /home/nanobot/.nanobot && \
chown -R nanobot:nanobot /home/nanobot /app/.venv
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN sed -i 's/\r$//' /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
# Start as root so the entrypoint can chown the data dir (on Render, the
# freshly-mounted root-owned persistent disk) before dropping to the non-root
# nanobot user via setpriv. The entrypoint drops privileges on every root start
# and fails closed if it cannot, so the agent never runs as root (see
# entrypoint.sh).
USER root
ENV HOME=/home/nanobot
# Ensure crash output reaches Render logs (app output is otherwise swallowed on
# non-graceful exit).
ENV PYTHONUNBUFFERED=1 PYTHONFAULTHANDLER=1
EXPOSE 18790 8765
ENTRYPOINT ["entrypoint.sh"]
CMD ["status"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
In order to keep to nanobot's spirit of a modular, lean agentic harness, it should allow users to completely skip building the WebUI when building a nanobot Docker image. This could simply be achieved by following the existing
NANOBOT_SKIP_WEBUI_BUILDenvironment variable during the build stage too. If the variable is unset, the WebUI would be included in the build by default; otherwise, it would be skipped altogether.This allows people that use nanobot primarily via provider channels (WhatsApp, Telegram, etc.) and not the WebUI to build a smaller image. Recently, my 2 GiB nanobot VM has been unable to build its nanobot Docker image as the build process now causes it to run out of memory, due to how expensive building the WebUI is now. Skipping this step allows the image build to complete without issue, and much faster.
Here are the changes I'd suggest we could make to the Dockerfile to allow this
All reactions