khalednabawi11 commited on
Commit
75c7b83
·
verified ·
1 Parent(s): 11a2144

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -0
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /code
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ git \
9
+ curl \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements first to leverage Docker cache
13
+ COPY requirements.txt .
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy the application code (excluding models)
19
+ COPY app /code/app
20
+ COPY main.py .
21
+
22
+ # Create models directory
23
+ RUN mkdir -p /code/models
24
+
25
+ # Set environment variables
26
+ ENV HOST=0.0.0.0
27
+ ENV PORT=7860
28
+
29
+ # Expose the port that FastAPI will run on
30
+ EXPOSE 7860
31
+
32
+ # Command to run the FastAPI application
33
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]