8900 commited on
Update Dockerfile
Browse files- Dockerfile +25 -10
Dockerfile
CHANGED
|
@@ -3,30 +3,45 @@ FROM node:22-bookworm
|
|
| 3 |
ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
|
| 4 |
ARG OPENCLAW_REF=hf-spaces
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
RUN apt-get update &&
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
ENV PATH="/root/.bun/bin:${PATH}"
|
| 11 |
RUN corepack enable
|
| 12 |
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
# Clone + build
|
| 16 |
RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
ENV NODE_ENV=production
|
| 22 |
ENV OPENCLAW_PREFER_PNPM=1
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
#
|
| 26 |
COPY setup-hf-config.mjs /app/setup-hf-config.mjs
|
| 27 |
-
COPY entrypoint.sh /app/entrypoint.sh
|
| 28 |
-
RUN chmod +x /app/entrypoint.sh
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
RUN chown -R node:node /app && mkdir -p /home/user && chown -R node:node /home/user
|
| 31 |
USER node
|
| 32 |
|
|
|
|
| 3 |
ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
|
| 4 |
ARG OPENCLAW_REF=hf-spaces
|
| 5 |
|
| 6 |
+
# 安装依赖和 bun
|
| 7 |
+
RUN apt-get update && \
|
| 8 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates && \
|
| 9 |
+
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
| 10 |
+
curl -fsSL https://bun.sh/install | bash
|
| 11 |
|
| 12 |
ENV PATH="/root/.bun/bin:${PATH}"
|
| 13 |
RUN corepack enable
|
| 14 |
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
+
# Clone OpenClaw + 安装 + build + UI build
|
| 18 |
RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \
|
| 19 |
+
&& pnpm install --frozen-lockfile \
|
| 20 |
+
&& pnpm build \
|
| 21 |
+
&& pnpm ui:build
|
| 22 |
|
| 23 |
ENV NODE_ENV=production
|
| 24 |
ENV OPENCLAW_PREFER_PNPM=1
|
| 25 |
EXPOSE 7860
|
| 26 |
|
| 27 |
+
# Copy setup config
|
| 28 |
COPY setup-hf-config.mjs /app/setup-hf-config.mjs
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
# Entrypoint: 自动设置 OPENCLAW_HOME 并启动 gateway
|
| 31 |
+
RUN printf '%s\n' \
|
| 32 |
+
'#!/bin/sh' \
|
| 33 |
+
'set -e' \
|
| 34 |
+
'if mkdir -p /data/.openclaw 2>/dev/null; then' \
|
| 35 |
+
' export OPENCLAW_HOME=/data' \
|
| 36 |
+
'else' \
|
| 37 |
+
' export OPENCLAW_HOME=/home/user' \
|
| 38 |
+
' mkdir -p /home/user/.openclaw' \
|
| 39 |
+
'fi' \
|
| 40 |
+
'node /app/setup-hf-config.mjs' \
|
| 41 |
+
'exec node /app/openclaw.mjs gateway --allow-unconfigured --bind auto --port 7860 "$@"' \
|
| 42 |
+
> /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
| 43 |
+
|
| 44 |
+
# 权限
|
| 45 |
RUN chown -R node:node /app && mkdir -p /home/user && chown -R node:node /home/user
|
| 46 |
USER node
|
| 47 |
|