-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (20 loc) · 911 Bytes
/
Dockerfile
File metadata and controls
31 lines (20 loc) · 911 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.10-slim
WORKDIR /app
# Copy only requirements first for better Docker caching
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Download model to app-local directory so it's available at runtime
RUN mkdir -p /app/models && \
python -c "\
from sentence_transformers import SentenceTransformer; \
model = SentenceTransformer('paraphrase-MiniLM-L6-v2'); \
model.save('/app/models/paraphrase-MiniLM-L6-v2')"
# Optional: Clean up to save image space
RUN apt-get update && apt-get clean && rm -rf /root/.cache /var/lib/apt/lists/*
# Now copy the rest of the app
COPY . /app
# Set the environment port (used by Gunicorn)
ENV PORT=8080
# Run the app with Gunicorn (longer timeout to prevent SIGKILL on slow load)
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "1", "--timeout", "120", "backend:app"]