8900 commited on
Commit
08cb7ae
·
verified ·
1 Parent(s): 8fa8ea8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -18
Dockerfile CHANGED
@@ -1,9 +1,10 @@
1
- FROM node:22-bookworm AS builder
2
 
3
- # 预构建阶段(加快后续启动)
4
  RUN apt-get update && \
5
- apt-get install -y --no-install-recommends git ca-certificates && \
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}"
@@ -11,6 +12,7 @@ RUN corepack enable
11
 
12
  WORKDIR /app
13
 
 
14
  ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
15
  ARG OPENCLAW_REF=hf-spaces
16
 
@@ -19,26 +21,23 @@ RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . && \
19
  pnpm build && \
20
  pnpm ui:build
21
 
22
- # 最终运行阶段(使用预构建结果)
23
- FROM openclaw/openclaw:latest
24
-
25
- USER root
26
-
27
- RUN apt-get update \
28
- && apt-get install -y --no-install-recommends nginx \
29
- && rm -rf /var/lib/apt/lists/*
30
-
31
- RUN rm -f /etc/nginx/sites-enabled/default \
32
- && rm -f /etc/nginx/conf.d/default.conf
33
 
 
34
  COPY nginx.conf /etc/nginx/conf.d/openclaw.conf
35
  COPY setup-hf-config.mjs /app/setup-hf-config.mjs
36
  COPY start.sh /start.sh
 
37
  RUN chmod +x /start.sh
38
 
39
- # 使用环境变量传递 Token(推荐方式)
40
- ENV OPENCLAW_TOKEN=Li8900
 
 
 
 
41
 
42
  EXPOSE 7860
43
 
44
- CMD ["/start.sh"]
 
1
+ FROM node:22-bookworm
2
 
3
+ # 安装系统依赖
4
  RUN apt-get update && \
5
+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
6
+ git ca-certificates nginx \
7
+ && apt-get clean && rm -rf /var/lib/apt/lists/* && \
8
  curl -fsSL https://bun.sh/install | bash
9
 
10
  ENV PATH="/root/.bun/bin:${PATH}"
 
12
 
13
  WORKDIR /app
14
 
15
+ # 克隆并构建 OpenClaw(这是必须的步骤)
16
  ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
17
  ARG OPENCLAW_REF=hf-spaces
18
 
 
21
  pnpm build && \
22
  pnpm ui:build
23
 
24
+ ENV OPENCLAW_PREFER_PNPM=1
25
+ ENV NODE_ENV=production
 
 
 
 
 
 
 
 
 
26
 
27
+ # 复制你的配置文件
28
  COPY nginx.conf /etc/nginx/conf.d/openclaw.conf
29
  COPY setup-hf-config.mjs /app/setup-hf-config.mjs
30
  COPY start.sh /start.sh
31
+
32
  RUN chmod +x /start.sh
33
 
34
+ # 权限设置
35
+ RUN chown -R node:node /app && \
36
+ mkdir -p /home/user && \
37
+ chown -R node:node /home/user
38
+
39
+ USER node
40
 
41
  EXPOSE 7860
42
 
43
+ ENTRYPOINT ["/start.sh"]