Veda-Labs commited on
Commit
d0ceb61
·
verified ·
1 Parent(s): 4711ff8

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base Image: Lightweight Python 3.10
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Copy requirements and install dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Create a non-root user (Mandatory for security in Hugging Face Spaces)
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+
15
+ # Set environment variables for the non-root user
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
+
19
+ # Change working directory to the user's home
20
+ WORKDIR $HOME/app
21
+
22
+ # Copy the rest of the application code with proper ownership
23
+ COPY --chown=user . $HOME/app
24
+
25
+ # Expose the standard Hugging Face port
26
+ EXPOSE 7860
27
+
28
+ # Run the Flask application
29
+ # (Using python directly since we are relying on Flask's internal server for background threads)
30
+ CMD ["python", "app.py"]