yangg40 commited on
Commit
73de42d
·
verified ·
1 Parent(s): ea72792

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.10 base image
2
+ FROM python:3.10-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
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Create non-root user (required by HF Spaces)
13
+ RUN useradd -m -u 1000 user
14
+ USER user
15
+ ENV HOME=/home/user
16
+ ENV PATH=/home/user/.local/bin:$PATH
17
+
18
+ # Set working directory for user
19
+ WORKDIR $HOME/app
20
+
21
+ # Copy requirements first (for caching)
22
+ COPY --chown=user requirements.txt .
23
+
24
+ # Install Python dependencies
25
+ RUN pip install --no-cache-dir --upgrade pip && \
26
+ pip install --no-cache-dir -r requirements.txt
27
+
28
+ # Copy application code
29
+ COPY --chown=user app.py .
30
+
31
+ # Expose port
32
+ EXPOSE 7860
33
+
34
+ # Run the Flask app
35
+ CMD ["python", "app.py"]