Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +14 -12
Dockerfile
CHANGED
@@ -5,26 +5,26 @@ RUN apt-get update \
|
|
5 |
&& apt-get install -y --no-install-recommends git \
|
6 |
&& rm -rf /var/lib/apt/lists/*
|
7 |
|
8 |
-
# 2) Prep HF & numba caches
|
9 |
-
ENV
|
10 |
-
TRANSFORMERS_CACHE=/tmp/hfcache \
|
11 |
-
SENTENCE_TRANSFORMERS_HOME=/tmp/hfcache \
|
12 |
-
NUMBA_CACHE_DIR=/tmp/numba_cache \
|
13 |
-
PIP_NO_CACHE_DIR=1 \
|
14 |
PYTHONUNBUFFERED=1 \
|
15 |
EMBED_MODEL=Seznam/simcse-small-e-czech \
|
16 |
MIN_TOPIC_SIZE=10 \
|
17 |
-
MAX_DOCS=5000
|
|
|
|
|
|
|
|
|
18 |
|
19 |
RUN mkdir -p /tmp/hfcache /tmp/numba_cache \
|
20 |
&& chmod -R 777 /tmp/hfcache /tmp/numba_cache
|
21 |
|
22 |
-
# 3) Install Python
|
23 |
WORKDIR /code
|
24 |
-
COPY requirements.txt
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
|
27 |
-
# 4) Pre-download the Czech SBERT model
|
28 |
RUN python - <<'PY'
|
29 |
from sentence_transformers import SentenceTransformer
|
30 |
SentenceTransformer(
|
@@ -34,7 +34,9 @@ SentenceTransformer(
|
|
34 |
PY
|
35 |
RUN chmod -R 777 /tmp/hfcache
|
36 |
|
37 |
-
# 5) Copy
|
38 |
-
COPY app.py
|
39 |
EXPOSE 7860
|
|
|
|
|
40 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
5 |
&& apt-get install -y --no-install-recommends git \
|
6 |
&& rm -rf /var/lib/apt/lists/*
|
7 |
|
8 |
+
# 2) Prep HF & numba caches and set runtime envs
|
9 |
+
ENV PIP_NO_CACHE_DIR=1 \
|
|
|
|
|
|
|
|
|
10 |
PYTHONUNBUFFERED=1 \
|
11 |
EMBED_MODEL=Seznam/simcse-small-e-czech \
|
12 |
MIN_TOPIC_SIZE=10 \
|
13 |
+
MAX_DOCS=5000 \
|
14 |
+
HF_HOME=/tmp/hfcache \
|
15 |
+
TRANSFORMERS_CACHE=/tmp/hfcache \
|
16 |
+
SENTENCE_TRANSFORMERS_HOME=/tmp/hfcache \
|
17 |
+
NUMBA_CACHE_DIR=/tmp/numba_cache
|
18 |
|
19 |
RUN mkdir -p /tmp/hfcache /tmp/numba_cache \
|
20 |
&& chmod -R 777 /tmp/hfcache /tmp/numba_cache
|
21 |
|
22 |
+
# 3) Install Python dependencies (pins in requirements.txt)
|
23 |
WORKDIR /code
|
24 |
+
COPY requirements.txt ./
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
|
27 |
+
# 4) Pre-download the Czech SBERT model into the cache
|
28 |
RUN python - <<'PY'
|
29 |
from sentence_transformers import SentenceTransformer
|
30 |
SentenceTransformer(
|
|
|
34 |
PY
|
35 |
RUN chmod -R 777 /tmp/hfcache
|
36 |
|
37 |
+
# 5) Copy application code and expose port
|
38 |
+
COPY app.py ./
|
39 |
EXPOSE 7860
|
40 |
+
|
41 |
+
# 6) Launch
|
42 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|