inchey commited on
Commit
0639c07
·
verified ·
1 Parent(s): 57605cd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -13
Dockerfile CHANGED
@@ -1,22 +1,32 @@
1
  FROM ubuntu:22.04
2
 
3
- # Install ttyd and basic dependencies
 
 
 
4
  RUN apt-get update && apt-get install -y \
5
- ttyd \
6
- bash \
7
  curl \
 
 
 
 
 
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
- # Copy your opencode binary or scripts into the container
11
- # (Adjust this part to match how your opencode utility is installed)
12
- COPY . /app
13
- WORKDIR /app
 
 
 
 
14
 
15
- # Expose the default port used by Hugging Face Spaces / ttyd
16
  EXPOSE 7860
17
 
18
- # FIXES:
19
- # 1. Removed the broken uppercase "-W" flag completely.
20
- # 2. Chained "; bash" to the start command so the terminal stays open
21
- # interactively even after 'opencode' finishes executing.
22
- CMD ["ttyd", "-p", "7860", "bash", "-c", "opencode; bash"]
 
1
  FROM ubuntu:22.04
2
 
3
+ # Prevent interactive prompts during installation
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # Install core dependencies, Node.js (via NodeSource for v18+ support), and ttyd
7
  RUN apt-get update && apt-get install -y \
 
 
8
  curl \
9
+ git \
10
+ python3 \
11
+ python3-pip \
12
+ build-essential \
13
+ ttyd \
14
+ && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
15
+ && apt-get install -y nodejs \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # 1. Install OpenCode globally via its official Node package manager registry
19
+ RUN npm install -g opencode-ai
20
+
21
+ # 2. Verify that npm registered the command globally (This creates /usr/bin/opencode or /usr/local/bin/opencode)
22
+ RUN opencode --version
23
+
24
+ # Create a project workspace directory
25
+ WORKDIR /workspace
26
 
27
+ # Hugging Face Spaces run on port 7860
28
  EXPOSE 7860
29
 
30
+ # Expose OpenCode globally over the web terminal interface
31
+ # ttyd will call 'opencode' safely out of npm's globally registered bin PATH
32
+ CMD ["ttyd", "-p", "7860", "-W", "bash", "-c", "opencode"]