-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (20 loc) · 843 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (20 loc) · 843 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
# 1. Use an official Python image as the base
FROM python:3.11-slim
# 2. Install system dependencies for OpenCV
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# 3. Set the working directory inside the container
WORKDIR /app
# 4. Copy requirements.txt and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Copy the rest of the application code
COPY . .
# Preload models (add the same code you use in Python here)
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5'); SentenceTransformer('all-MiniLM-L6-v2')"
# 6. Expose port 8000
EXPOSE 8000
# 7. Run the app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]