inchey commited on
Commit
561d235
·
verified ·
1 Parent(s): 8aab619

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -25
Dockerfile CHANGED
@@ -1,32 +1,22 @@
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"]
 
1
+ FROM python:3.10-slim
2
 
3
+ # Set up a generic, secure user to comply with Hugging Face requirements
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
 
9
+ WORKDIR $HOME/app
 
 
 
 
 
 
 
 
 
 
10
 
11
+ # Copy and install dependencies
12
+ COPY --chown=user requirements.txt .
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
15
+ # Copy the rest of the web app code
16
+ COPY --chown=user . .
17
 
18
+ # Expose the mandatory port required by Hugging Face Spaces
 
 
 
19
  EXPOSE 7860
20
 
21
+ # Launch Streamlit pointing to the correct address configuration
22
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]