Keyan2006 commited on
Commit
4fa1efa
·
verified ·
1 Parent(s): 6e50cc0

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -0
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.11 base image
2
+ FROM python:3.11-slim
3
+
4
+ # Create user for security (required by HF Spaces)
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Set working directory
8
+ WORKDIR /app
9
+
10
+ # Copy requirements first (better caching)
11
+ COPY --chown=user requirements.txt .
12
+
13
+ # Install dependencies
14
+ RUN pip install --no-cache-dir --upgrade pip && \
15
+ pip install --no-cache-dir -r requirements.txt
16
+
17
+ # Copy application code
18
+ COPY --chown=user . .
19
+
20
+ # Switch to non-root user (HF Spaces requirement)
21
+ USER user
22
+
23
+ # Set environment variables
24
+ ENV HOME=/home/user \
25
+ PATH=/home/user/.local/bin:$PATH \
26
+ PYTHONUNBUFFERED=1
27
+
28
+ # Expose port 7860 (HF Spaces default)
29
+ EXPOSE 7860
30
+
31
+ # Start application
32
+ CMD ["python", "app.py"]