wearevenom commited on
Commit
3434ef3
·
verified ·
1 Parent(s): 7f3d9aa

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -11
Dockerfile CHANGED
@@ -1,11 +1,23 @@
1
- FROM python:3.10
2
-
3
- WORKDIR /code
4
-
5
- COPY ./requirements.txt /code/requirements.txt
6
-
7
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
-
9
- COPY . /code
10
-
11
- CMD ["uvicorn", "fapi:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ WORKDIR /code
4
+
5
+ # Create cache directories with proper permissions
6
+ RUN mkdir -p /tmp/cache/huggingface && \
7
+ chmod 777 /tmp/cache/huggingface
8
+
9
+ # Set environment variables for cache directories
10
+ ENV HF_HOME=/tmp/cache/huggingface
11
+ ENV TRANSFORMERS_CACHE=/tmp/cache/huggingface
12
+ ENV SENTENCE_TRANSFORMERS_HOME=/tmp/cache/huggingface
13
+
14
+ COPY ./requirements.txt /code/requirements.txt
15
+
16
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
17
+
18
+ # Pre-download the sentence transformer model during build
19
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
20
+
21
+ COPY . /code
22
+
23
+ CMD ["uvicorn", "fapi:app", "--host", "0.0.0.0", "--port", "7860"]