| |
| |
|
|
| FROM node:22-bookworm |
|
|
| |
| ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git |
| ARG OPENCLAW_REF=hf-spaces |
|
|
| |
| 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/* \ |
| && curl -fsSL https://bun.sh/install | bash |
| ENV PATH="/root/.bun/bin:${PATH}" |
|
|
| RUN corepack enable |
|
|
| WORKDIR /app |
|
|
| |
| RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . \ |
| && pnpm install --frozen-lockfile \ |
| && pnpm build |
| ENV OPENCLAW_PREFER_PNPM=1 |
| RUN pnpm ui:build |
|
|
| ENV NODE_ENV=production |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| RUN printf '%s\n' \ |
| '#!/bin/sh' \ |
| 'set -e' \ |
| 'if mkdir -p /data/.openclaw 2>/dev/null; then' \ |
| ' export OPENCLAW_HOME=/data' \ |
| 'else' \ |
| ' export OPENCLAW_HOME=/home/user' \ |
| ' mkdir -p /home/user/.openclaw' \ |
| 'fi' \ |
| 'node /app/spaces/huggingface/setup-hf-config.mjs' \ |
| 'exec node /app/openclaw.mjs gateway --allow-unconfigured --bind lan --port 7860 "$@"' \ |
| > /app/entrypoint.sh \ |
| && chmod +x /app/entrypoint.sh |
|
|
| |
| RUN chown -R node:node /app \ |
| && mkdir -p /home/user \ |
| && chown -R node:node /home/user |
| USER node |
|
|
| |
| ENTRYPOINT ["/app/entrypoint.sh"] |
|
|