sheikh987 commited on
Commit
df42fba
·
verified ·
1 Parent(s): 25ebce3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -15
Dockerfile CHANGED
@@ -1,21 +1,20 @@
1
- # Use a slim Python base image for a smaller footprint
2
- FROM python:3.9-slim
3
 
4
- # Set the working directory inside the container
5
- WORKDIR /code
6
 
7
- # Copy the requirements file first to leverage Docker cache
8
- COPY ./requirements.txt /code/requirements.txt
 
9
 
10
- # Install the Python dependencies
11
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
13
- # Copy all the other files from your repository (main.py, model.pth, etc.)
14
- COPY . /code/
 
15
 
16
- # Expose the port that Gradio uses by default
17
- EXPOSE 7860
18
 
19
- # The command to start your application
20
- # Gradio's `iface.launch()` in your main.py starts the server, so we just run the script.
21
- CMD ["python", "main.py"]
 
1
+ FROM python:3.10-slim
 
2
 
3
+ WORKDIR /app
 
4
 
5
+ # Set Hugging Face cache
6
+ ENV HF_HOME=/app/hf_cache
7
+ RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
8
 
9
+ # Install Git and cleanup
10
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Install Python packages
13
+ COPY requirements.txt .
14
+ RUN pip install --upgrade pip && pip install -r requirements.txt
15
 
16
+ # Copy code
17
+ COPY main.py .
18
 
19
+ # ✅ Run with main.py, and port 7860 (required by Hugging Face)
20
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]