codewithharsha commited on
Commit
7fe41ca
·
verified ·
1 Parent(s): 2c955fe

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -0
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official lightweight Python image
2
+ FROM python:3.10-slim
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ # git is needed for some pip packages, build-essential for C extensions
9
+ RUN apt-get update && apt-get install -y \
10
+ build-essential \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy the requirements file first to leverage Docker layer caching
15
+ COPY requirements.txt requirements.txt
16
+
17
+ # Install Python dependencies
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Copy the rest of your application code into the container
21
+ COPY . .
22
+
23
+ # Expose the port the app will run on
24
+ # We'll use 7860 as specified in your Hugging Face README
25
+ EXPOSE 7860
26
+
27
+ # Set the port as an environment variable
28
+ ENV PORT=7860
29
+
30
+ # Command to run the application in production using Gunicorn
31
+ # This will run the 'app' object from your 'main.py' file.
32
+ CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:7860", "main:app"]