File size: 1,041 Bytes
33b5e73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use Node 22 for OpenClaude compatibility
FROM node:22-bookworm

# 1. Install system tools (ripgrep is required by OpenClaude)
RUN apt-get update && apt-get install -y \
    ripgrep build-essential cmake git libjson-c-dev libwebsockets-dev \
    && rm -rf /var/lib/apt/lists/*

# 2. Install ttyd (Web Terminal)
RUN git clone --depth=1 https://github.com/tsl0922/ttyd.git && \
    cd ttyd && mkdir build && cd build && \
    cmake .. && make && make install && \
    cd ../.. && rm -rf ttyd

# 3. Create a non-root user (Required for HF Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 4. Install OpenClaude globally for the user
RUN npm install -g @gitlawb/openclaude

# 5. Set up the persistent directory
# We assume the Bucket is mounted at /data
WORKDIR /data

# Expose the HF default port
EXPOSE 7860

# Start ttyd. 
# -W allows writing (typing in the terminal)
# -p 7860 is the port HF listens to
# /bin/bash is the starting shell
CMD ["ttyd", "-W", "-p", "7860", "/bin/bash"]