ethnmcl commited on
Commit
8db9436
·
verified ·
1 Parent(s): 1641ecf

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Space (Docker) — FastAPI + sentence-transformers
2
+ FROM python:3.11-slim
3
+
4
+ # System deps
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential git && rm -rf /var/lib/apt/lists/*
7
+
8
+ WORKDIR /app
9
+
10
+ # Python deps first (layer cache)
11
+ COPY requirements.txt /app/
12
+ ENV PIP_NO_CACHE_DIR=1
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
+
15
+ # App
16
+ COPY main.py /app/
17
+
18
+ # Default envs (override in Space settings → Variables & Secrets)
19
+ ENV TZ=America/New_York
20
+ ENV MODEL_NAME=BAAI/bge-small-en-v1.5
21
+
22
+ # HF Spaces exposes $PORT (usually 7860). Bind to it.
23
+ ENV PORT=7860
24
+ EXPOSE 7860
25
+
26
+ # Run the API
27
+ CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT} --workers 1"]