Update Dockerfile
Browse files- Dockerfile +21 -8
Dockerfile
CHANGED
|
@@ -4,9 +4,8 @@
|
|
| 4 |
FROM node:22-bookworm
|
| 5 |
|
| 6 |
# Optional: point to a fork or branch (set in Space Variables)
|
| 7 |
-
ARG OPENCLAW_REPO=https://github.com/
|
| 8 |
-
|
| 9 |
-
ARG OPENCLAW_REF=hf-spaces
|
| 10 |
|
| 11 |
# Install git and Bun (needed for build scripts)
|
| 12 |
RUN apt-get update && \
|
|
@@ -28,14 +27,28 @@ RUN pnpm ui:build
|
|
| 28 |
|
| 29 |
ENV NODE_ENV=production
|
| 30 |
|
| 31 |
-
# Hugging Face Spaces: persist config/workspace under /data (only available at runtime)
|
| 32 |
-
ENV OPENCLAW_HOME=/data
|
| 33 |
-
|
| 34 |
# Spaces expose a single port (default 7860); gateway must listen on 0.0.0.0
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
USER node
|
| 39 |
|
| 40 |
# Token/password: set OPENCLAW_GATEWAY_TOKEN or OPENCLAW_GATEWAY_PASSWORD in Space Secrets
|
| 41 |
-
|
|
|
|
| 4 |
FROM node:22-bookworm
|
| 5 |
|
| 6 |
# Optional: point to a fork or branch (set in Space Variables)
|
| 7 |
+
ARG OPENCLAW_REPO=https://github.com/openclaw/openclaw.git
|
| 8 |
+
ARG OPENCLAW_REF=main
|
|
|
|
| 9 |
|
| 10 |
# Install git and Bun (needed for build scripts)
|
| 11 |
RUN apt-get update && \
|
|
|
|
| 27 |
|
| 28 |
ENV NODE_ENV=production
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
# Spaces expose a single port (default 7860); gateway must listen on 0.0.0.0
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
+
# Entrypoint: use /data if writable (persistent storage), else /home/user so we don't get EACCES
|
| 34 |
+
RUN printf '%s\n' \
|
| 35 |
+
'#!/bin/sh' \
|
| 36 |
+
'set -e' \
|
| 37 |
+
'if mkdir -p /data/.openclaw 2>/dev/null; then' \
|
| 38 |
+
' export OPENCLAW_HOME=/data' \
|
| 39 |
+
'else' \
|
| 40 |
+
' export OPENCLAW_HOME=/home/user' \
|
| 41 |
+
' mkdir -p /home/user/.openclaw' \
|
| 42 |
+
'fi' \
|
| 43 |
+
'exec node /app/openclaw.mjs gateway --allow-unconfigured --bind lan --port 7860 "$@"' \
|
| 44 |
+
> /app/entrypoint.sh \
|
| 45 |
+
&& chmod +x /app/entrypoint.sh
|
| 46 |
+
|
| 47 |
+
# HF Spaces Dev Mode injects steps that expect /home/user; create it so they don't fail with "Permission denied"
|
| 48 |
+
RUN chown -R node:node /app \
|
| 49 |
+
&& mkdir -p /home/user \
|
| 50 |
+
&& chown -R node:node /home/user
|
| 51 |
USER node
|
| 52 |
|
| 53 |
# Token/password: set OPENCLAW_GATEWAY_TOKEN or OPENCLAW_GATEWAY_PASSWORD in Space Secrets
|
| 54 |
+
ENTRYPOINT ["/app/entrypoint.sh"]
|