Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Node 22 for OpenClaude compatibility
|
| 2 |
+
FROM node:22-bookworm
|
| 3 |
+
|
| 4 |
+
# 1. Install system tools (ripgrep is required by OpenClaude)
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
ripgrep build-essential cmake git libjson-c-dev libwebsockets-dev \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# 2. Install ttyd (Web Terminal)
|
| 10 |
+
RUN git clone --depth=1 https://github.com/tsl0922/ttyd.git && \
|
| 11 |
+
cd ttyd && mkdir build && cd build && \
|
| 12 |
+
cmake .. && make && make install && \
|
| 13 |
+
cd ../.. && rm -rf ttyd
|
| 14 |
+
|
| 15 |
+
# 3. Create a non-root user (Required for HF Spaces)
|
| 16 |
+
RUN useradd -m -u 1000 user
|
| 17 |
+
USER user
|
| 18 |
+
ENV HOME=/home/user \
|
| 19 |
+
PATH=/home/user/.local/bin:$PATH
|
| 20 |
+
|
| 21 |
+
# 4. Install OpenClaude globally for the user
|
| 22 |
+
RUN npm install -g @gitlawb/openclaude
|
| 23 |
+
|
| 24 |
+
# 5. Set up the persistent directory
|
| 25 |
+
# We assume the Bucket is mounted at /data
|
| 26 |
+
WORKDIR /data
|
| 27 |
+
|
| 28 |
+
# Expose the HF default port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Start ttyd.
|
| 32 |
+
# -W allows writing (typing in the terminal)
|
| 33 |
+
# -p 7860 is the port HF listens to
|
| 34 |
+
# /bin/bash is the starting shell
|
| 35 |
+
CMD ["ttyd", "-W", "-p", "7860", "/bin/bash"]
|