harshpatel080503 commited on
Commit
c9d6294
·
verified ·
1 Parent(s): f80ea37

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile
2
+
3
+ # Use official Python base image
4
+ FROM python:3.10-slim
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # Install system dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ git \
12
+ build-essential \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Install Python dependencies
16
+ COPY requirements.txt .
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy your application code
20
+ COPY . .
21
+
22
+ # Expose port for FastAPI
23
+ EXPOSE 7860
24
+
25
+ # Set environment variables for Hugging Face token and OpenAI key (Optional here, set them via Hugging Face Space settings for security)
26
+ ENV HUGGINGFACEHUB_ACCESS_TOKEN=${HUGGINGFACEHUB_ACCESS_TOKEN}
27
+ ENV OPENAI_API_KEY=${OPENAI_API_KEY}
28
+
29
+ # Start FastAPI app using uvicorn
30
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]