tao-shen commited on
Commit
06bbb4d
Β·
verified Β·
1 Parent(s): d93dc07

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -51
Dockerfile CHANGED
@@ -1,58 +1,19 @@
1
- # OpenClaw on Hugging Face Spaces β€” Pre-built image (v3.9)
2
- # Uses official pre-built image to avoid 30+ minute builds on cpu-basic
3
 
4
- # ── Stage 1: Pull pre-built OpenClaw ─────────────────────────────────────────
5
- FROM ghcr.io/openclaw/openclaw:latest AS openclaw-prebuilt
6
-
7
- # ── Stage 2: Runtime ─────────────────────────────────────────────────────────
8
- FROM node:22-bookworm
9
- SHELL ["/bin/bash", "-c"]
10
-
11
- # ── System dependencies (root) ───────────────────────────────────────────────
12
- RUN echo "[build] Installing system deps..." && START=$(date +%s) \
13
- && apt-get update \
14
- && apt-get install -y --no-install-recommends git ca-certificates curl python3 python3-pip \
15
- && rm -rf /var/lib/apt/lists/* \
16
- && pip3 install --no-cache-dir --break-system-packages huggingface_hub \
17
- && corepack enable \
18
- && mkdir -p /app/openclaw \
19
- && chown -R node:node /app \
20
- && mkdir -p /home/node/.openclaw/workspace /home/node/.openclaw/credentials \
21
- && chown -R node:node /home/node \
22
- && echo "[build] System deps: $(($(date +%s) - START))s"
23
-
24
- # ── Copy pre-built OpenClaw (skips clone + install + build entirely) ─────────
25
- COPY --from=openclaw-prebuilt --chown=node:node /app /app/openclaw
26
-
27
- USER node
28
- ENV HOME=/home/node
29
  WORKDIR /app
30
 
31
- # ── A2A Gateway Extension ───────────────────────────────────────────────────
32
- RUN echo "[build] Installing A2A gateway..." && START=$(date +%s) \
33
- && git clone --depth 1 https://github.com/win4r/openclaw-a2a-gateway.git /app/openclaw/extensions/a2a-gateway \
34
- && cd /app/openclaw/extensions/a2a-gateway \
35
- && npm install --production \
36
- && echo "[build] A2A gateway: $(($(date +%s) - START))s"
37
 
38
- # ── Prepare runtime dirs ────────────────────────────────────────────────────
39
- RUN mkdir -p /app/openclaw/empty-bundled-plugins \
40
- && node -e "try{console.log(require('/app/openclaw/package.json').version)}catch(e){console.log('unknown')}" > /app/openclaw/.version \
41
- && echo "[build] OpenClaw version: $(cat /app/openclaw/.version)"
42
 
43
- # ── Scripts + Config + Frontend ──────────────────────────────────────────────
44
- COPY --chown=node:node scripts /home/node/scripts
45
- COPY --chown=node:node frontend /home/node/frontend
46
- COPY --chown=node:node openclaw.json /home/node/scripts/openclaw.json.default
47
- RUN chmod +x /home/node/scripts/entrypoint.sh /home/node/scripts/sync_hf.py \
48
- && VERSION_TS=$(date +%s) \
49
- && sed "s/{{VERSION_TIMESTAMP}}/${VERSION_TS}/g" /home/node/frontend/electron-standalone.html > /home/node/frontend/index.html \
50
- && echo "[build] Frontend index.html generated (timestamp=${VERSION_TS})"
51
 
52
- ENV NODE_ENV=production
53
- ENV OPENCLAW_BUNDLED_PLUGINS_DIR=/app/openclaw/empty-bundled-plugins
54
- ENV OPENCLAW_PREFER_PNPM=1
55
- ENV PATH="/home/node/.local/bin:$PATH"
56
- WORKDIR /home/node
57
 
58
- CMD ["/home/node/scripts/entrypoint.sh"]
 
 
1
+ FROM python:3.9-slim
 
2
 
3
+ # Set the working directory to /app (this was /workspace before, causing the runtime error)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  WORKDIR /app
5
 
6
+ # Copy the requirements file
7
+ COPY requirements.txt .
 
 
 
 
8
 
9
+ # Install dependencies
10
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
11
 
12
+ # Copy the application code
13
+ COPY . .
 
 
 
 
 
 
14
 
15
+ # Expose the port
16
+ EXPOSE 7860
 
 
 
17
 
18
+ # Run the application
19
+ CMD ["streamlit", "run", "app.py"]