vomebook commited on
Commit
46b2e27
·
1 Parent(s): b64bb25

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # 安装系统依赖(gzip 用于压缩 JSON 响应)
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ gzip \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ COPY requirements.txt .
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ COPY app.py .
14
+ COPY static/ static/
15
+ COPY data/ data/
16
+
17
+ # 可选:预压缩 search_data.json 加速首次加载
18
+ RUN if [ -f data/search_data.json ]; then \
19
+ gzip -k -9 data/search_data.json; \
20
+ fi
21
+
22
+ EXPOSE 7860
23
+
24
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]