hisham-cmd commited on
Commit
ada7ad5
·
verified ·
1 Parent(s): f59b086

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.12-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy the requirements file into the container
13
+ COPY requirements.txt .
14
+
15
+ # Install any needed packages specified in requirements.txt
16
+ # Using CPU version of torch to keep the image size smaller and compatible with free CPU spaces
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of the application code into the container
20
+ COPY . .
21
+
22
+ # Expose port 7860 as required by Hugging Face Spaces
23
+ EXPOSE 7860
24
+
25
+ # Define environment variables
26
+ ENV PYTHONUNBUFFERED=1
27
+ ENV HOST=0.0.0.0
28
+ ENV PORT=7860
29
+
30
+ # Command to run the application
31
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]