datdevsteve commited on
Commit
c192a04
·
verified ·
1 Parent(s): cb28d1e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -16
Dockerfile CHANGED
@@ -1,16 +1,30 @@
1
- FROM python:3.10
2
-
3
- # Copy all files
4
- COPY . .
5
-
6
- # Set working directory
7
- WORKDIR /
8
-
9
- # Install dependencies
10
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
-
12
- # Expose port 7860 (HF Spaces default)
13
- EXPOSE 7860
14
-
15
- # Start FastAPI on port 7860
16
- CMD ["uvicorn", "api_backend:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Environment sanity
7
+ ENV PYTHONDONTWRITEBYTECODE=1
8
+ ENV PYTHONUNBUFFERED=1
9
+
10
+ # Install system dependencies
11
+ RUN apt-get update && apt-get install -y \
12
+ build-essential \
13
+ git \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Copy requirements first (better caching)
17
+ COPY requirements.txt .
18
+
19
+ # Install Python dependencies
20
+ RUN pip install --no-cache-dir --upgrade pip \
21
+ && pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy application code
24
+ COPY . .
25
+
26
+ # HF Spaces port
27
+ EXPOSE 7860
28
+
29
+ # Start FastAPI
30
+ CMD ["uvicorn", "api_backend:app", "--host", "0.0.0.0", "--port", "7860"]