tharu22 commited on
Commit
11f4c89
·
1 Parent(s): 703dd7a
Files changed (1) hide show
  1. Dockerfile +12 -14
Dockerfile CHANGED
@@ -1,24 +1,22 @@
1
- # Use an official Python base image
2
- FROM python:3.11-slim
3
 
4
- # Set the working directory inside the container
5
  WORKDIR /app
 
6
 
7
- # Set Hugging Face cache directory to a writable location
8
- ENV HF_HOME="/tmp/huggingface"
9
 
10
- # Copy the requirements file
11
- COPY requirements.txt .
 
12
 
13
- # Install dependencies and update huggingface_hub
14
- RUN pip install --no-cache-dir -r requirements.txt \
15
- && pip install --upgrade huggingface_hub
16
 
17
- # Copy the entire app to the container
18
- COPY . .
19
 
20
- # Expose FastAPI's default port
 
 
 
 
 
21
  EXPOSE 7860
22
 
23
- # Run FastAPI with Uvicorn
24
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.9-slim
 
2
 
 
3
  WORKDIR /app
4
+ COPY . /app
5
 
6
+ ENV HF_HOME=/app/.cache
 
7
 
8
+ RUN mkdir -p /app/.cache/huggingface/hub && \
9
+ chmod -R 777 /app/.cache && \
10
+ chmod -R 777 /app/.cache/huggingface
11
 
 
 
 
12
 
 
 
13
 
14
+ RUN pip install --upgrade pip
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ COPY --chown=user ./requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
+
20
  EXPOSE 7860
21
 
 
22
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]