MisbahKhan commited on
Commit
35ada41
·
verified ·
1 Parent(s): 8eed836

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -0
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as the base image
2
+ FROM python:3.9
3
+
4
+ # Create a user to avoid running as root (Hugging Face Spaces recommendation)
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ WORKDIR /app
8
+ ENV PATH="/home/user/.local/bin:$PATH"
9
+
10
+ # Copy requirements.txt and install dependencies
11
+ COPY --chown=user ./requirements.txt requirements.txt
12
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
+
14
+ # Copy the rest of the application files
15
+ COPY --chown=user . /app
16
+
17
+ # Expose the port FastAPI will run on (Hugging Face Spaces default is 7860)
18
+ EXPOSE 7860
19
+
20
+ # Command to run the FastAPI app with Uvicorn
21
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]