waveyourarms commited on
Commit
125bed3
·
verified ·
1 Parent(s): d6d7bc6

Upload dockerfile.py

Browse files
Files changed (1) hide show
  1. dockerfile.py +34 -0
dockerfile.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python image
2
+ FROM python:3.11-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ curl \
11
+ software-properties-common \
12
+ git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Copy requirements and install
16
+ COPY requirements.txt .
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy app code
20
+ COPY . .
21
+
22
+ # Create a non-root user (Hugging Face preference for security)
23
+ RUN useradd -m -u 1000 user
24
+ USER user
25
+ ENV HOME=/home/user \
26
+ PATH=/home/user/.local/bin:$PATH
27
+ WORKDIR $HOME/app
28
+ COPY --chown=user . $HOME/app
29
+
30
+ # THE CRITICAL PART:
31
+ # 1. Port must be 7860 (Hugging Face default)
32
+ # 2. Address must be 0.0.0.0
33
+ # 3. enableXsrfProtection must be false for iFrame support
34
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]