build(docker): remove node from runtime image
This commit is contained in:
+13
-12
@@ -1,15 +1,16 @@
|
|||||||
|
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
|
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
||||||
|
|
||||||
# Install Node.js for the WebUI build
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends curl ca-certificates gnupg git bubblewrap openssh-client && \
|
apt-get install -y --no-install-recommends ca-certificates 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/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -18,13 +19,13 @@ WORKDIR /app
|
|||||||
# hook from hatch_build.py even for this metadata-only install.
|
# hook from hatch_build.py even for this metadata-only install.
|
||||||
COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./
|
COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES.md hatch_build.py ./
|
||||||
RUN mkdir -p nanobot && touch nanobot/__init__.py && \
|
RUN mkdir -p nanobot && touch nanobot/__init__.py && \
|
||||||
uv pip install --system --no-cache ".[whatsapp]" && \
|
NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]" && \
|
||||||
rm -rf nanobot
|
rm -rf nanobot
|
||||||
|
|
||||||
# Copy the full source and install
|
# Copy the full source and install
|
||||||
COPY nanobot/ nanobot/
|
COPY nanobot/ nanobot/
|
||||||
COPY webui/ webui/
|
COPY --from=webui-builder /app/nanobot/web/dist/ nanobot/web/dist/
|
||||||
RUN NANOBOT_FORCE_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]"
|
RUN NANOBOT_SKIP_WEBUI_BUILD=1 uv pip install --system --no-cache ".[whatsapp]"
|
||||||
|
|
||||||
# Create non-root user and config directory
|
# Create non-root user and config directory
|
||||||
RUN useradd -m -u 1000 -s /bin/bash nanobot && \
|
RUN useradd -m -u 1000 -s /bin/bash nanobot && \
|
||||||
|
|||||||
Reference in New Issue
Block a user