renminwansui1976 commited on
Commit
21c0bd2
·
unverified ·
1 Parent(s): aa7309c

更新 Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -13
Dockerfile CHANGED
@@ -13,24 +13,34 @@ COPY Cargo.lock ./
13
  COPY src ./src
14
  RUN cargo build --release --locked
15
 
16
- # ── Stage 2: Runtime — use OpenClaw's official image (Node 22 + openclaw.mjs)
 
17
  FROM ghcr.io/openclaw/openclaw:latest AS runtime
18
 
19
- # Switch to root just long enough to install tini and copy our binary
20
  USER root
 
 
21
  RUN apt-get update \
22
- && apt-get install -y --no-install-recommends tini ca-certificates \
 
 
 
23
  && rm -rf /var/lib/apt/lists/*
24
 
 
25
  COPY --from=builder /app/target/release/openclaw-hf-sync /usr/local/bin/openclaw-hf-sync
26
  RUN chmod +x /usr/local/bin/openclaw-hf-sync
27
 
28
- # Ensure the openclaw data dir exists and is owned by the node user (uid 1000)
 
 
 
 
29
  RUN mkdir -p /home/node/.openclaw && chown -R node:node /home/node/.openclaw
30
 
31
- # ── OpenClaw port config ───────────────────────────────────────────────────────
32
- # HF Space expects the app to listen on 7860 (declared in README.md app_port).
33
- # We override OpenClaw's default (18789) so the Space health-check passes.
34
  ENV OPENCLAW_API_PORT=7860 \
35
  OPENCLAW_WS_PORT=7861 \
36
  HOME=/home/node
@@ -40,10 +50,10 @@ EXPOSE 7860 7861
40
  WORKDIR /app
41
  USER node
42
 
43
- # ── Entrypoint ────────────────────────────────────────────────────────────────
44
- # openclaw-hf-sync wraps the child process:
45
- # 1. pull ~/.openclaw from the HF dataset
46
- # 2. spawn the OpenClaw gateway (arguments after --)
47
- # 3. push changes back on a timer and on shutdown
48
  ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/openclaw-hf-sync"]
49
- CMD ["node", "openclaw.mjs", "gateway", "--allow-unconfigured"]
 
13
  COPY src ./src
14
  RUN cargo build --release --locked
15
 
16
+ # ── Stage 2: Runtime ──────────────────────────────────────────────────────────
17
+ # Base: OpenClaw official image (Node 22 + openclaw.mjs)
18
  FROM ghcr.io/openclaw/openclaw:latest AS runtime
19
 
 
20
  USER root
21
+
22
+ # Install: tini (pid1), curl (health-check), Python 3 + pip (LiteLLM)
23
  RUN apt-get update \
24
+ && apt-get install -y --no-install-recommends \
25
+ tini ca-certificates curl \
26
+ python3 python3-pip \
27
+ && pip3 install --no-cache-dir --break-system-packages litellm[proxy] \
28
  && rm -rf /var/lib/apt/lists/*
29
 
30
+ # Copy Rust sync binary
31
  COPY --from=builder /app/target/release/openclaw-hf-sync /usr/local/bin/openclaw-hf-sync
32
  RUN chmod +x /usr/local/bin/openclaw-hf-sync
33
 
34
+ # Copy startup script
35
+ COPY start.sh /app/start.sh
36
+ RUN chmod +x /app/start.sh
37
+
38
+ # Ensure OpenClaw data dir belongs to the node user (uid 1000)
39
  RUN mkdir -p /home/node/.openclaw && chown -R node:node /home/node/.openclaw
40
 
41
+ # ── Port config ───────────────────────────────────────────────────────────────
42
+ # HF Space health-check expects port 7860.
43
+ # OpenClaw listens on OPENCLAW_API_PORT; LiteLLM proxy on 4000 (internal only).
44
  ENV OPENCLAW_API_PORT=7860 \
45
  OPENCLAW_WS_PORT=7861 \
46
  HOME=/home/node
 
50
  WORKDIR /app
51
  USER node
52
 
53
+ # ── Entrypoint ────────────────────────────────────────────────────────────────
54
+ # openclaw-hf-sync:
55
+ # 1. Pulls ~/.openclaw workspace from the HF dataset
56
+ # 2. Spawns start.sh (LiteLLM proxy OpenClaw gateway)
57
+ # 3. Periodically pushes workspace changes back, and on shutdown
58
  ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/openclaw-hf-sync"]
59
+ CMD ["/app/start.sh"]