8900 commited on
Commit
714d0d8
·
verified ·
1 Parent(s): 5192d31

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -23
Dockerfile CHANGED
@@ -4,41 +4,30 @@ ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
4
  ARG OPENCLAW_REF=hf-spaces
5
 
6
  # 系统依赖 + Bun
7
- RUN apt-get update && 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
  ENV PATH="/root/.bun/bin:${PATH}"
11
  RUN corepack enable
12
 
13
  WORKDIR /app
14
 
15
- # Clone OpenClaw + build backend + UI
16
- RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . && \
17
- pnpm install --frozen-lockfile && \
18
- pnpm build && \
19
- pnpm ui:build
20
 
21
  ENV NODE_ENV=production
22
  ENV OPENCLAW_PREFER_PNPM=1
23
  EXPOSE 7860
24
 
25
- # Copy our production setup
26
  COPY setup-hf-config.mjs /app/setup-hf-config.mjs
27
-
28
- # Entrypoint: setup config + start gateway
29
- RUN printf '%s\n' \
30
- '#!/bin/sh' \
31
- 'set -e' \
32
- 'if mkdir -p /data/.openclaw 2>/dev/null; then' \
33
- ' export OPENCLAW_HOME=/data' \
34
- 'else' \
35
- ' export OPENCLAW_HOME=/home/user' \
36
- ' mkdir -p /home/user/.openclaw' \
37
- 'fi' \
38
- 'node /app/setup-hf-config.mjs' \
39
- 'exec node /app/openclaw.mjs gateway --allow-unconfigured --bind lan --port 7860 "$@"' \
40
- > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
41
 
42
  RUN chown -R node:node /app && mkdir -p /home/user && chown -R node:node /home/user
43
  USER node
 
44
  ENTRYPOINT ["/app/entrypoint.sh"]
 
4
  ARG OPENCLAW_REF=hf-spaces
5
 
6
  # 系统依赖 + Bun
7
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates && 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}"
11
  RUN corepack enable
12
 
13
  WORKDIR /app
14
 
15
+ # Clone + build
16
+ RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \
17
+ && pnpm install --frozen-lockfile \
18
+ && pnpm build \
19
+ && pnpm ui:build
20
 
21
  ENV NODE_ENV=production
22
  ENV OPENCLAW_PREFER_PNPM=1
23
  EXPOSE 7860
24
 
25
+ # 拷贝配置和 entrypoint
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
+
33
  ENTRYPOINT ["/app/entrypoint.sh"]