Kareman commited on
Commit
17e2d86
·
1 Parent(s): acc643d

feat: add dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +56 -0
Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # ------------------------
6
+ # Environment
7
+ # ------------------------
8
+
9
+ ENV PYTHONUNBUFFERED=1
10
+ ENV PYTHONDONTWRITEBYTECODE=1
11
+
12
+ # HuggingFace cache
13
+ ENV HF_HOME=/tmp/.cache
14
+ ENV TRANSFORMERS_CACHE=/tmp/.cache
15
+ ENV HUGGINGFACE_HUB_CACHE=/tmp/.cache
16
+
17
+ RUN mkdir -p /tmp/.cache && chmod -R 777 /tmp/.cache
18
+
19
+ # ------------------------
20
+ # System packages
21
+ # ------------------------
22
+
23
+ RUN apt-get update && apt-get install -y \
24
+ build-essential \
25
+ git \
26
+ && rm -rf /var/lib/apt/lists/*
27
+
28
+ # ------------------------
29
+ # Python packages
30
+ # ------------------------
31
+
32
+ COPY requirements.txt .
33
+
34
+ RUN pip install --upgrade pip
35
+
36
+ RUN pip install --no-cache-dir -r requirements.txt
37
+
38
+ # ------------------------
39
+ # Download embedding model
40
+ # ------------------------
41
+
42
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"
43
+
44
+ # ------------------------
45
+ # Copy project
46
+ # ------------------------
47
+
48
+ COPY . .
49
+
50
+ # ------------------------
51
+ # HuggingFace Spaces
52
+ # ------------------------
53
+
54
+ EXPOSE 7860
55
+
56
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]