-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 777 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (23 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM python:3.11-slim
WORKDIR /app
# Ensure transformers / ST cache is stored in a persistent path inside image
ENV HF_HOME=/app/.cache
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download SentenceTransformer model (cached under HF_HOME)
RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
# Copy application code
COPY . .
EXPOSE 8000
# Gunicorn config
ENV GUNICORN_WORKERS=4
ENV APP_HOST=0.0.0.0
ENV APP_PORT=8000
CMD ["sh", "-c", "gunicorn app.main:app \
-w ${GUNICORN_WORKERS} \
-k uvicorn.workers.UvicornWorker \
--bind ${APP_HOST}:${APP_PORT} \
--preload \
--timeout 120 \
--graceful-timeout 120"]