sedtha commited on
Commit
9e4906d
·
verified ·
1 Parent(s): 6a7584c

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Prevent Python from writing .pyc files
4
+ ENV PYTHONDONTWRITEBYTECODE=1
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ libglib2.0-0 \
11
+ libsm6 \
12
+ libxext6 \
13
+ libxrender-dev \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Set working directory
17
+ WORKDIR /app
18
+
19
+ # Copy requirements first (for caching)
20
+ COPY requirements.txt .
21
+
22
+ # Install Python dependencies (CPU only)
23
+ RUN pip install --no-cache-dir --upgrade pip && \
24
+ pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy application files
27
+ COPY app.py .
28
+ COPY rice_leaf_model.pth .
29
+ COPY README.md .
30
+
31
+ # Expose Hugging Face required port
32
+ EXPOSE 7860
33
+
34
+ # Start FastAPI
35
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]