HunzalaRasheed1 commited on
Commit
bd55d63
·
verified ·
1 Parent(s): f9752df

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -0
Dockerfile ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /code
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ build-essential \
9
+ curl \
10
+ software-properties-common \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy requirements first for better caching
15
+ COPY requirements.txt /code/requirements.txt
16
+
17
+ # Install Python dependencies
18
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
19
+
20
+ # Copy application files
21
+ COPY . /code/
22
+
23
+ # Create directories for data and models
24
+ RUN mkdir -p /code/data /code/models
25
+
26
+ # Set environment variables
27
+ ENV PYTHONPATH=/code
28
+ ENV PYTHONUNBUFFERED=1
29
+
30
+ # Expose the port
31
+ EXPOSE 7860
32
+
33
+ # Health check
34
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
35
+ CMD curl -f http://localhost:7860/health || exit 1
36
+
37
+ # Run the application
38
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]