omar100abdelaal commited on
Commit
f30c5a4
·
verified ·
1 Parent(s): 2884128

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -0
Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python base image
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE 1
6
+ ENV PYTHONUNBUFFERED 1
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
+ # Create a user to avoid running as root on Hugging Face
11
+ RUN useradd -m -u 1000 user
12
+ USER user
13
+ WORKDIR $HOME/app
14
+
15
+ # Copy requirements and install dependencies
16
+ COPY --chown=user requirements.txt $HOME/app/requirements.txt
17
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
18
+
19
+ # Copy the rest of the application
20
+ COPY --chown=user . $HOME/app
21
+
22
+ # Hugging Face Spaces expect the app to run on port 7860
23
+ EXPOSE 7860
24
+
25
+ # Command to run the application
26
+ CMD ["uvicorn", "ai_service:app", "--host", "0.0.0.0", "--port", "7860"]