harshalbondre commited on
Commit
f55b0b4
·
verified ·
1 Parent(s): 1997239

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Start with a base Python image
2
+ FROM python:3.9
3
+
4
+ # Create a user with UID 1000 to avoid running as root (recommended for Hugging Face Spaces)
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Set the user to 'user' (we will not run as root)
8
+ USER user
9
+
10
+ # Set environment variable for local bin directory
11
+ ENV PATH="/home/user/.local/bin:$PATH"
12
+
13
+ # Set the working directory to /app inside the container
14
+ WORKDIR /app
15
+
16
+ # Copy requirements.txt and install dependencies
17
+ COPY --chown=user ./requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
+
20
+ # Copy the entire application code into the container
21
+ COPY --chown=user . /app
22
+
23
+ # Set the default command to run the FastAPI app using Uvicorn
24
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]