Update Dockerfile
Browse files- Dockerfile +33 -18
Dockerfile
CHANGED
|
@@ -1,24 +1,39 @@
|
|
| 1 |
-
|
| 2 |
-
FROM node:22-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
RUN
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
RUN apt-get update && apt-get install -y \
|
| 9 |
-
build-essential \
|
| 10 |
-
python3 \
|
| 11 |
-
pkg-config \
|
| 12 |
-
libvips-dev \
|
| 13 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# 克隆 OpenClaw 源码
|
| 16 |
WORKDIR /app
|
| 17 |
-
RUN git clone https://github.com/openclaw/openclaw.git . \
|
| 18 |
-
&& pnpm install --frozen-lockfile
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:22-bookworm
|
|
|
|
| 2 |
|
| 3 |
+
# Install Bun (required for build scripts)
|
| 4 |
+
RUN curl -fsSL https://bun.sh/install | bash
|
| 5 |
+
ENV PATH="/root/.bun/bin:${PATH}"
|
| 6 |
|
| 7 |
+
RUN corepack enable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
|
|
|
| 9 |
WORKDIR /app
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
ARG OPENCLAW_DOCKER_APT_PACKAGES=""
|
| 12 |
+
RUN if [ -n "$OPENCLAW_DOCKER_APT_PACKAGES" ]; then \
|
| 13 |
+
apt-get update && \
|
| 14 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $OPENCLAW_DOCKER_APT_PACKAGES && \
|
| 15 |
+
apt-get clean && \
|
| 16 |
+
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \
|
| 17 |
+
fi
|
| 18 |
|
| 19 |
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
| 20 |
+
COPY ui/package.json ./ui/package.json
|
| 21 |
+
COPY patches ./patches
|
| 22 |
+
COPY scripts ./scripts
|
| 23 |
+
|
| 24 |
+
RUN pnpm install --frozen-lockfile
|
| 25 |
+
|
| 26 |
+
COPY . .
|
| 27 |
+
RUN OPENCLAW_A2UI_SKIP_MISSING=1 pnpm build
|
| 28 |
+
# Force pnpm for UI build (Bun may fail on ARM/Synology architectures)
|
| 29 |
+
ENV OPENCLAW_PREFER_PNPM=1
|
| 30 |
+
RUN pnpm ui:build
|
| 31 |
+
|
| 32 |
+
ENV NODE_ENV=production
|
| 33 |
+
|
| 34 |
+
# Security hardening: Run as non-root user
|
| 35 |
+
# The node:22-bookworm image includes a 'node' user (uid 1000)
|
| 36 |
+
# This reduces the attack surface by preventing container escape via root privileges
|
| 37 |
+
USER node
|
| 38 |
+
|
| 39 |
+
CMD ["node", "dist/index.js"]
|