8900 commited on
Update Dockerfile
Browse files- Dockerfile +30 -13
Dockerfile
CHANGED
|
@@ -1,25 +1,42 @@
|
|
| 1 |
FROM node:22-bookworm
|
| 2 |
-
|
|
|
|
| 3 |
ARG OPENCLAW_REF=hf-spaces
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
apt-get
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
ENV PATH="/root/.bun/bin:${PATH}"
|
|
|
|
| 9 |
RUN corepack enable
|
|
|
|
| 10 |
WORKDIR /app
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
ENV OPENCLAW_PREFER_PNPM=1
|
| 15 |
-
RUN pnpm ui:build
|
| 16 |
ENV NODE_ENV=production
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
COPY entrypoint.sh /app/entrypoint.sh
|
| 19 |
RUN chmod +x /app/entrypoint.sh
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
chown -R node:node /
|
|
|
|
|
|
|
|
|
|
| 23 |
USER node
|
|
|
|
| 24 |
EXPOSE 7860
|
|
|
|
|
|
|
| 25 |
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
| 1 |
FROM node:22-bookworm
|
| 2 |
+
|
| 3 |
+
ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
|
| 4 |
ARG OPENCLAW_REF=hf-spaces
|
| 5 |
+
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates && \
|
| 8 |
+
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
| 9 |
+
curl -fsSL https://bun.sh/install | bash
|
| 10 |
+
|
| 11 |
ENV PATH="/root/.bun/bin:${PATH}"
|
| 12 |
+
|
| 13 |
RUN corepack enable
|
| 14 |
+
|
| 15 |
WORKDIR /app
|
| 16 |
+
|
| 17 |
+
# 克隆 + 安装 + 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 OPENCLAW_PREFER_PNPM=1
|
|
|
|
| 24 |
ENV NODE_ENV=production
|
| 25 |
+
|
| 26 |
+
# COPY 本地 setup-hf-config.mjs 和 entrypoint.sh
|
| 27 |
+
# 注意 entrypoint.sh 内部将调用 /app/setup-hf-config.mjs
|
| 28 |
+
COPY setup-hf-config.mjs /app/setup-hf-config.mjs
|
| 29 |
COPY entrypoint.sh /app/entrypoint.sh
|
| 30 |
RUN chmod +x /app/entrypoint.sh
|
| 31 |
+
|
| 32 |
+
# 权限设置
|
| 33 |
+
RUN chown -R node:node /app && \
|
| 34 |
+
mkdir -p /home/user && \
|
| 35 |
+
chown -R node:node /home/user
|
| 36 |
+
|
| 37 |
USER node
|
| 38 |
+
|
| 39 |
EXPOSE 7860
|
| 40 |
+
|
| 41 |
+
# ENTRYPOINT 保持不变,执行 entrypoint.sh
|
| 42 |
ENTRYPOINT ["/app/entrypoint.sh"]
|