This commit is contained in:
parent
f3cffa392d
commit
c89dd8dd77
78
Dockerfile
78
Dockerfile
|
|
@ -1,39 +1,59 @@
|
|||
FROM ubuntu:22.04
|
||||
########################
|
||||
# 1️⃣ Build stage
|
||||
########################
|
||||
FROM python:3.10-slim AS builder
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 安装 Python 3.10 和基础工具
|
||||
# 系统依赖:编译 C/C++ 扩展 & git 拉源码
|
||||
RUN apt-get update && \
|
||||
apt-get install -y software-properties-common curl git && \
|
||||
add-apt-repository ppa:deadsnakes/ppa && \
|
||||
apt-get update && \
|
||||
apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip && \
|
||||
ln -sf python3.10 /usr/bin/python3 && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
git \
|
||||
curl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
WORKDIR /build
|
||||
|
||||
# 拷贝源码(包含 requirements 子目录)
|
||||
COPY evalscope.0.17.0/ ./evalscope
|
||||
COPY gradio_ui.py .
|
||||
# 先复制 requirements 目录,利用 Docker layer cache
|
||||
COPY evalscope.0.17.0/requirements ./evalscope/requirements
|
||||
|
||||
# 升级 pip 工具
|
||||
# 更新 pip & 预装常用 build tools
|
||||
RUN pip install --upgrade pip setuptools wheel
|
||||
|
||||
# ✅ 安装所有模块依赖
|
||||
RUN pip 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 && \
|
||||
pip install -e ./evalscope && \
|
||||
# ✅ 清理 pip 缓存
|
||||
rm -rf /root/.cache/pip
|
||||
# 把所有依赖装进 /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 本体(非 editable,减少后续 COPY)
|
||||
COPY evalscope.0.17.0/ ./evalscope
|
||||
RUN pip install --no-cache-dir --prefix=/install ./evalscope
|
||||
|
||||
# 仅带上入口脚本
|
||||
COPY gradio_ui.py .
|
||||
|
||||
########################
|
||||
# 2️⃣ Runtime stage
|
||||
########################
|
||||
FROM python:3.10-slim AS runtime
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 把 builder 阶段产物注入到 /usr/local 下
|
||||
# /install/bin 里可能有可执行文件;site-packages 在 /install/lib/…
|
||||
COPY --from=builder /install /usr/local
|
||||
COPY --from=builder /build/gradio_ui.py /app/gradio_ui.py
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 7900
|
||||
|
||||
# 可选:彻底关闭 pip 缓存,避免 runtime 再次安装时产生垃圾
|
||||
ENV PIP_NO_CACHE_DIR=1
|
||||
|
||||
# 启动 Gradio 服务
|
||||
CMD ["python3", "gradio_ui.py"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
FROM ubuntu:22.04
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 安装 Python 3.10 和基础工具
|
||||
RUN apt-get update && \
|
||||
apt-get install -y software-properties-common curl git && \
|
||||
add-apt-repository ppa:deadsnakes/ppa && \
|
||||
apt-get update && \
|
||||
apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip && \
|
||||
ln -sf python3.10 /usr/bin/python3 && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 拷贝源码(包含 requirements 子目录)
|
||||
COPY evalscope.0.17.0/ ./evalscope
|
||||
COPY gradio_ui.py .
|
||||
|
||||
# 升级 pip 工具
|
||||
RUN pip install --upgrade pip setuptools wheel
|
||||
|
||||
# ✅ 安装所有模块依赖
|
||||
RUN pip 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 && \
|
||||
pip install -e ./evalscope && \
|
||||
# ✅ 清理 pip 缓存
|
||||
rm -rf /root/.cache/pip
|
||||
|
||||
# 启动 Gradio 服务
|
||||
CMD ["python3", "gradio_ui.py"]
|
||||
Loading…
Reference in New Issue