Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +12 -51
Dockerfile
CHANGED
|
@@ -1,58 +1,19 @@
|
|
| 1 |
-
|
| 2 |
-
# Uses official pre-built image to avoid 30+ minute builds on cpu-basic
|
| 3 |
|
| 4 |
-
#
|
| 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 |
-
#
|
| 32 |
-
|
| 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 |
-
#
|
| 39 |
-
RUN
|
| 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 |
-
#
|
| 44 |
-
COPY
|
| 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 |
-
|
| 53 |
-
|
| 54 |
-
ENV OPENCLAW_PREFER_PNPM=1
|
| 55 |
-
ENV PATH="/home/node/.local/bin:$PATH"
|
| 56 |
-
WORKDIR /home/node
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
| 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"]
|