2026-06-26 16:55:21 +08:00
|
|
|
FROM node:24-bookworm-slim AS webui-builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY webui/package.json webui/package-lock.json ./webui/
|
|
|
|
|
WORKDIR /app/webui
|
|
|
|
|
RUN npm ci
|
|
|
|
|
COPY webui/ ./
|
|
|
|
|
RUN mkdir -p /app/nanobot/web && npm run build
|
|
|
|
|
|
2026-02-02 08:55:21 +00:00
|
|
|
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
2026-06-26 16:55:21 +08:00
|
|
|
apt-get install -y --no-install-recommends ca-certificates git bubblewrap openssh-client && \
|
2026-02-02 08:55:21 +00:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-05-17 10:12:02 +08:00
|
|
|
# Install Python dependencies first (cached layer). Hatch reads the custom build
|
|
|
|
|
# hook from hatch_build.py even for this metadata-only install.
|
|
|
|
|
COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./
|
2026-06-26 15:52:32 +08:00
|
|
|
RUN mkdir -p nanobot && touch nanobot/__init__.py && \
|
2026-06-26 16:55:21 +08:00
|
|
|
NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]" && \
|
2026-06-26 15:52:32 +08:00
|
|
|
rm -rf nanobot
|
2026-02-02 08:55:21 +00:00
|
|
|
|
2026-06-26 16:32:25 +08:00
|
|
|
# Copy the full source and install
|
2026-02-02 08:55:21 +00:00
|
|
|
COPY nanobot/ nanobot/
|
2026-06-26 16:55:21 +08:00
|
|
|
COPY --from=webui-builder /app/nanobot/web/dist/ nanobot/web/dist/
|
|
|
|
|
RUN NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]"
|
2026-02-02 08:55:21 +00:00
|
|
|
|
2026-03-16 23:55:19 -07:00
|
|
|
# Create non-root user and config directory
|
|
|
|
|
RUN useradd -m -u 1000 -s /bin/bash nanobot && \
|
|
|
|
|
mkdir -p /home/nanobot/.nanobot && \
|
|
|
|
|
chown -R nanobot:nanobot /home/nanobot /app
|
|
|
|
|
|
2026-04-06 13:15:40 +00:00
|
|
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
2026-04-07 07:37:01 +03:00
|
|
|
RUN sed -i 's/\r$//' /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
|
2026-04-06 13:15:40 +00:00
|
|
|
|
2026-03-16 23:55:19 -07:00
|
|
|
USER nanobot
|
|
|
|
|
ENV HOME=/home/nanobot
|
2026-02-02 08:55:21 +00:00
|
|
|
|
2026-05-17 15:45:15 +08:00
|
|
|
# Gateway health endpoint and optional WebUI/WebSocket channel ports
|
|
|
|
|
EXPOSE 18790 8765
|
2026-02-02 08:55:21 +00:00
|
|
|
|
2026-04-06 13:15:40 +00:00
|
|
|
ENTRYPOINT ["entrypoint.sh"]
|
2026-02-02 16:36:22 +07:00
|
|
|
CMD ["status"]
|