This commit is contained in:
parent
16691c07c6
commit
77f3697358
20
Dockerfile
20
Dockerfile
|
|
@ -19,10 +19,10 @@ COPY evalscope.0.17.0/requirements ./evalscope/requirements
|
||||||
|
|
||||||
# 更新 pip,并提前装 antlr4-runtime
|
# 更新 pip,并提前装 antlr4-runtime
|
||||||
RUN pip install --upgrade pip setuptools wheel && \
|
RUN pip install --upgrade pip setuptools wheel && \
|
||||||
pip install --no-cache-dir --prefix=/install antlr4-python3-runtime==4.9.3
|
pip install --no-cache-dir antlr4-python3-runtime==4.9.3
|
||||||
|
|
||||||
# 安装 EvalScope 所有依赖到 /install
|
# 安装 EvalScope 所有依赖(使用默认 site-packages)
|
||||||
RUN pip install --no-cache-dir --prefix=/install \
|
RUN pip install --no-cache-dir \
|
||||||
-r ./evalscope/requirements/framework.txt \
|
-r ./evalscope/requirements/framework.txt \
|
||||||
-r ./evalscope/requirements/opencompass.txt \
|
-r ./evalscope/requirements/opencompass.txt \
|
||||||
-r ./evalscope/requirements/vlmeval.txt \
|
-r ./evalscope/requirements/vlmeval.txt \
|
||||||
|
|
@ -35,11 +35,10 @@ RUN pip install --no-cache-dir --prefix=/install \
|
||||||
|
|
||||||
# 安装 EvalScope 本体
|
# 安装 EvalScope 本体
|
||||||
COPY evalscope.0.17.0/ ./evalscope
|
COPY evalscope.0.17.0/ ./evalscope
|
||||||
RUN pip install --no-cache-dir --prefix=/install ./evalscope
|
RUN pip install --no-cache-dir ./evalscope
|
||||||
|
|
||||||
# ✅ 加这一段
|
# ✅ 安装 nltk 并下载 punkt 模型(到 /nltk_data)
|
||||||
RUN pip install --no-cache-dir --prefix=/install nltk && \
|
RUN pip install --no-cache-dir nltk && \
|
||||||
PYTHONPATH=/install/lib/python3.10/site-packages \
|
|
||||||
python3 -m nltk.downloader -d /nltk_data punkt
|
python3 -m nltk.downloader -d /nltk_data punkt
|
||||||
|
|
||||||
# 拷贝入口文件
|
# 拷贝入口文件
|
||||||
|
|
@ -51,11 +50,14 @@ COPY gradio_ui.py .
|
||||||
FROM python:3.10-slim AS runtime
|
FROM python:3.10-slim AS runtime
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# 拷贝构建阶段所有已安装包
|
# 拷贝构建阶段已安装内容
|
||||||
COPY --from=builder /install /usr/local
|
COPY --from=builder /usr/local /usr/local
|
||||||
COPY --from=builder /nltk_data /usr/local/nltk_data
|
COPY --from=builder /nltk_data /usr/local/nltk_data
|
||||||
COPY --from=builder /build/gradio_ui.py /app/gradio_ui.py
|
COPY --from=builder /build/gradio_ui.py /app/gradio_ui.py
|
||||||
|
|
||||||
|
# 设置 NLTK 数据路径(可选但推荐)
|
||||||
|
ENV NLTK_DATA=/usr/local/nltk_data
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 7900 7901
|
EXPOSE 7900 7901
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
########################
|
||||||
|
# 1️⃣ Build stage
|
||||||
|
########################
|
||||||
|
FROM python:3.10-slim AS builder
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# 安装系统依赖
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
git \
|
||||||
|
curl && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# 拷贝 requirements 并安装依赖
|
||||||
|
COPY evalscope.0.17.0/requirements ./evalscope/requirements
|
||||||
|
|
||||||
|
# 更新 pip,并提前装 antlr4-runtime
|
||||||
|
RUN pip install --upgrade pip setuptools wheel && \
|
||||||
|
pip install --no-cache-dir --prefix=/install antlr4-python3-runtime==4.9.3
|
||||||
|
|
||||||
|
# 安装 EvalScope 所有依赖到 /install
|
||||||
|
RUN pip install --no-cache-dir --prefix=/install \
|
||||||
|
-r ./evalscope/requirements/framework.txt \
|
||||||
|
-r ./evalscope/requirements/opencompass.txt \
|
||||||
|
-r ./evalscope/requirements/vlmeval.txt \
|
||||||
|
-r ./evalscope/requirements/aigc.txt \
|
||||||
|
-r ./evalscope/requirements/app.txt \
|
||||||
|
-r ./evalscope/requirements/dev.txt \
|
||||||
|
-r ./evalscope/requirements/docs.txt \
|
||||||
|
-r ./evalscope/requirements/perf.txt \
|
||||||
|
-r ./evalscope/requirements/rag.txt
|
||||||
|
|
||||||
|
# 安装 EvalScope 本体
|
||||||
|
COPY evalscope.0.17.0/ ./evalscope
|
||||||
|
RUN pip install --no-cache-dir --prefix=/install ./evalscope
|
||||||
|
|
||||||
|
# ✅ 加这一段
|
||||||
|
RUN pip install --no-cache-dir --prefix=/install nltk && \
|
||||||
|
PYTHONPATH=/install/lib/python3.10/site-packages \
|
||||||
|
python3 -m nltk.downloader -d /nltk_data punkt
|
||||||
|
|
||||||
|
# 拷贝入口文件
|
||||||
|
COPY gradio_ui.py .
|
||||||
|
|
||||||
|
########################
|
||||||
|
# 2️⃣ Runtime stage
|
||||||
|
########################
|
||||||
|
FROM python:3.10-slim AS runtime
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# 拷贝构建阶段所有已安装包
|
||||||
|
COPY --from=builder /install /usr/local
|
||||||
|
COPY --from=builder /nltk_data /usr/local/nltk_data
|
||||||
|
COPY --from=builder /build/gradio_ui.py /app/gradio_ui.py
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 7900 7901
|
||||||
|
|
||||||
|
# 防止 runtime 安装时产生缓存垃圾
|
||||||
|
ENV PIP_NO_CACHE_DIR=1
|
||||||
|
|
||||||
|
CMD ["python3", "gradio_ui.py"]
|
||||||
Loading…
Reference in New Issue