Create Dockerfile
Browse files- Dockerfile +41 -0
Dockerfile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OpenClaw Gateway for Hugging Face Spaces
|
| 2 |
+
# Build context: your Space repo (this Dockerfile + README). OpenClaw is cloned during build.
|
| 3 |
+
|
| 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/josephrp/openclaw.git
|
| 8 |
+
# 👆🏻change this line to yours , obviously !!
|
| 9 |
+
ARG OPENCLAW_REF=hf-spaces
|
| 10 |
+
|
| 11 |
+
# Install git and Bun (needed for build scripts)
|
| 12 |
+
RUN apt-get update && \
|
| 13 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates && \
|
| 14 |
+
apt-get clean && rm -rf /var/lib/apt/lists/* \
|
| 15 |
+
&& curl -fsSL https://bun.sh/install | bash
|
| 16 |
+
ENV PATH="/root/.bun/bin:${PATH}"
|
| 17 |
+
|
| 18 |
+
RUN corepack enable
|
| 19 |
+
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
|
| 22 |
+
# Clone OpenClaw and build (no COPY from host; Space repo only has this Dockerfile)
|
| 23 |
+
RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \
|
| 24 |
+
&& pnpm install --frozen-lockfile \
|
| 25 |
+
&& pnpm build
|
| 26 |
+
ENV OPENCLAW_PREFER_PNPM=1
|
| 27 |
+
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 |
+
RUN chown -R node:node /app
|
| 38 |
+
USER node
|
| 39 |
+
|
| 40 |
+
# Token/password: set OPENCLAW_GATEWAY_TOKEN or OPENCLAW_GATEWAY_PASSWORD in Space Secrets
|
| 41 |
+
CMD ["node", "openclaw.mjs", "gateway", "--allow-unconfigured", "--bind", "lan", "--port", "7860"]
|