abhy60098 commited on
Commit
f2858bc
·
verified ·
1 Parent(s): 311a898

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official lightweight Python runtime
2
+ FROM python:3.9-slim
3
+
4
+ # Set up a new user named "user" with UID 1000 to comply with HF Space permissions
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
+ # Set the working directory inside the container
11
+ WORKDIR $HOME/app
12
+
13
+ # Copy the requirements file and install dependencies
14
+ COPY --chown=user requirements.txt $HOME/app/requirements.txt
15
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
16
+
17
+ # Copy the rest of the application files into the container
18
+ COPY --chown=user . $HOME/app
19
+
20
+ # Expose port 7860 (Hugging Face expects the app to run on this port)
21
+ EXPOSE 7860
22
+
23
+ # Command to run the FastAPI app via uvicorn
24
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]