diff --git a/Dockerfile b/Dockerfile index 1bf995ea..526457ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,15 @@ -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 - FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim +# Install Node.js for the WebUI build RUN apt-get update && \ - apt-get install -y --no-install-recommends ca-certificates git bubblewrap openssh-client && \ + apt-get install -y --no-install-recommends curl ca-certificates gnupg git bubblewrap openssh-client && \ + mkdir -p /etc/apt/keyrings && \ + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_24.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends nodejs && \ + apt-get purge -y gnupg && \ + apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -19,13 +18,13 @@ WORKDIR /app # hook from hatch_build.py even for this metadata-only install. COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./ RUN mkdir -p nanobot && touch nanobot/__init__.py && \ - NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]" && \ + uv pip install --system --no-cache ".[whatsapp]" && \ rm -rf nanobot -# Copy the full source and install with the WebUI built in the Node-only stage. +# Copy the full source and install COPY nanobot/ nanobot/ -COPY --from=webui-builder /app/nanobot/web/dist/ nanobot/web/dist/ -RUN NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]" +COPY webui/ webui/ +RUN NANOBOT_FORCE_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]" # Create non-root user and config directory RUN useradd -m -u 1000 -s /bin/bash nanobot && \