Krishna Prakash commited on
Commit
cecd57a
·
1 Parent(s): e7cf806

Fixed Docker configuration for app module import on Hugging Face Spaces

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -5
Dockerfile CHANGED
@@ -1,8 +1,26 @@
1
- FROM python:3.11-slim
 
2
 
 
3
  WORKDIR /app
4
- COPY requirements.txt .
5
- RUN pip install -r requirements.txt
6
- COPY app/ .
7
 
8
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use official Python 3.9 image
2
+ FROM python:3.9
3
 
4
+ # Set working directory to /app (root of the repository)
5
  WORKDIR /app
 
 
 
6
 
7
+ # Copy requirements file
8
+ COPY ./requirements.txt /app/requirements.txt
9
+
10
+ # Install dependencies
11
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
+
13
+ # Copy the entire project
14
+ COPY . /app
15
+
16
+ # Run as non-root user (required by Hugging Face)
17
+ RUN useradd -m -u 1000 user
18
+ USER user
19
+ ENV HOME=/home/user \
20
+ PATH=/home/user/.local/bin:$PATH
21
+
22
+ # Expose port
23
+ EXPOSE 7860
24
+
25
+ # Command to run the app, adjusting for the app/ subdirectory
26
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]