forked from Teng91/chatbot-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
34 lines (26 loc) · 1.13 KB
/
Copy pathDockerfile.dev
File metadata and controls
34 lines (26 loc) · 1.13 KB
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
32
33
34
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONPATH=/app/src \
VIRTUAL_ENV=/app/.venv \
PATH=/app/.venv/bin:$PATH \
FASTEMBED_CACHE_PATH=/app/.fastembed_cache \
PORT=8000
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libpq-dev git \
&& rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:0.10.12 /uv /usr/local/bin/uv
COPY pyproject.toml uv.lock ./
RUN uv sync --no-dev
# Sparse embedding 已移至獨立的 fastembed service,這裡只預載 reranker
ARG RAG_RERANKER_MODEL=jinaai/jina-reranker-v2-base-multilingual
RUN set -eu; \
cache="$FASTEMBED_CACHE_PATH"; \
mkdir -p "$cache"; \
if [ -n "$RAG_RERANKER_MODEL" ]; then \
echo "Downloading reranker model: $RAG_RERANKER_MODEL"; \
/app/.venv/bin/python -c "from fastembed.rerank.cross_encoder import TextCrossEncoder; TextCrossEncoder('$RAG_RERANKER_MODEL', cache_dir='$cache')"; \
fi
EXPOSE 8000
# src/ 透過 docker-compose volumes 掛載;--reload 支援 hot-reload
CMD ["sh", "-c", "uvicorn chatbot_plugin.main:app --host 0.0.0.0 --port ${PORT:-8000} --reload"]