rahul7star commited on
Commit
6e6ec6e
·
verified ·
1 Parent(s): 0b2dbc8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -31
Dockerfile CHANGED
@@ -1,39 +1,16 @@
1
  FROM python:3.10-slim
2
 
3
- # Install git and other dependencies
4
- RUN apt update && apt install -y git && apt clean
5
 
6
- # Set up environment
7
- ENV PYTHONUNBUFFERED=1 \
8
- PORT=8000 \
9
- HF_HOME=/home/user/huggingface \
10
- GRADIO_ALLOW_FLAGGING=never \
11
- GRADIO_NUM_PORTS=1 \
12
- GRADIO_SERVER_NAME=0.0.0.0 \
13
- GRADIO_THEME=huggingface \
14
- SYSTEM=spaces \
15
- PATH=/home/user/.local/bin:$PATH \
16
- HOME=/home/user \
17
- PYTHONPATH=/home/user/app
18
 
19
- # Create user and required dirs
20
- RUN useradd -m -u 1000 user && mkdir -p /home/user/huggingface /home/user/app
21
 
22
- # Set working directory to user's app dir
23
- WORKDIR /home/user/app
24
-
25
- # Copy source as the correct user
26
- COPY --chown=user . .
27
-
28
- # Switch to user for safer permissions
29
- USER user
30
-
31
- # Install Python dependencies
32
- COPY requirements.txt /home/user/app/requirements.txt
33
- RUN pip install --no-cache-dir -r /home/user/app/requirements.txt
34
-
35
- # Expose the correct port
36
  EXPOSE 7860
37
 
38
  # Start the FastAPI app
39
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
3
+ WORKDIR /app
 
4
 
5
+ # Install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
8
 
9
+ # Copy FastAPI app
10
+ COPY app.py .
11
 
12
+ # Expose the port Hugging Face Spaces expects
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  EXPOSE 7860
14
 
15
  # Start the FastAPI app
16
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]