8900 commited on
Commit
ed8238f
·
verified ·
1 Parent(s): 4815a04

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -13
Dockerfile CHANGED
@@ -1,35 +1,39 @@
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 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates curl && apt-get clean && rm -rf /var/lib/apt/lists/* \
7
- && curl -fsSL https://bun.sh/install | bash
8
 
9
  ENV PATH="/root/.bun/bin:${PATH}"
 
10
  RUN corepack enable
11
 
12
  WORKDIR /app
13
 
14
- # 拉取源码、安装依赖、构建
15
- RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \
16
- && pnpm install --frozen-lockfile \
17
- && pnpm build
 
18
 
19
  ENV OPENCLAW_PREFER_PNPM=1
20
 
 
21
  RUN pnpm ui:build
22
 
23
  ENV NODE_ENV=production
24
 
25
- # 覆盖配置脚本与入口
26
- COPY setup-hf-config.mjs /app/spaces/huggingface/setup-hf-config.mjs
27
  COPY entrypoint.sh /app/entrypoint.sh
28
  RUN chmod +x /app/entrypoint.sh
29
 
30
- # 权限调整
31
  RUN chown -R node:node /app && mkdir -p /home/user && chown -R node:node /home/user
32
- USER node
33
 
 
34
  EXPOSE 7860
 
35
  ENTRYPOINT ["/app/entrypoint.sh"]
 
1
  FROM node:22-bookworm
2
 
3
+ # 安装依赖
4
+ RUN apt-get update && \
5
+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates curl && \
6
+ apt-get clean && rm -rf /var/lib/apt/lists/* && \
7
+ curl -fsSL https://bun.sh/install | bash
8
 
9
  ENV PATH="/root/.bun/bin:${PATH}"
10
+
11
  RUN corepack enable
12
 
13
  WORKDIR /app
14
 
15
+ # 克隆 OpenClaw Hugging Face 分支,并安装依赖
16
+ ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
17
+ ARG OPENCLAW_REF=hf-spaces
18
+ RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . && \
19
+ pnpm install --frozen-lockfile && pnpm build
20
 
21
  ENV OPENCLAW_PREFER_PNPM=1
22
 
23
+ # UI 构建
24
  RUN pnpm ui:build
25
 
26
  ENV NODE_ENV=production
27
 
28
+ # COPY 配置文件到 /app 根目录(entrypoint.sh 使用)
29
+ COPY setup-hf-config.mjs /app/setup-hf-config.mjs
30
  COPY entrypoint.sh /app/entrypoint.sh
31
  RUN chmod +x /app/entrypoint.sh
32
 
33
+ # 权限设置
34
  RUN chown -R node:node /app && mkdir -p /home/user && chown -R node:node /home/user
 
35
 
36
+ USER node
37
  EXPOSE 7860
38
+
39
  ENTRYPOINT ["/app/entrypoint.sh"]