cjo93 commited on
Commit
8647fad
·
verified ·
1 Parent(s): e22e7ec

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -5
Dockerfile CHANGED
@@ -1,11 +1,19 @@
1
  FROM python:3.9
2
 
3
- WORKDIR /code
 
 
 
4
 
5
- COPY ./requirements.txt /code/requirements.txt
6
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
7
 
8
- COPY . .
 
 
9
 
10
- # FIX: Bind to 0.0.0.0 and port 7860
 
 
 
 
11
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9
2
 
3
+ # Create a user to avoid permission issues
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV PATH="/home/user/.local/bin:${PATH}"
7
 
8
+ WORKDIR /home/user/app
 
9
 
10
+ # Install dependencies
11
+ COPY --chown=user requirements.txt .
12
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
+ # Copy the rest of the application
15
+ COPY --chown=user . .
16
+
17
+ # CRITICAL FIX: Bind to 0.0.0.0 and Port 7860
18
+ # Without this, Hugging Face will show a 404 error
19
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]