# 使用官方的Python 3.10基础镜像 FROM python:3.10 # 设置工作目录 WORKDIR /app # 复制当前目录下的所有文件到工作目录 COPY . /app # 配置pip使用清华镜像源 RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple # 配置python环境 RUN pip install --no-cache-dir -r requirements.txt RUN mv /usr/local/lib/python3.10/site-packages/gradio/templates/frontend/index.html /usr/local/lib/python3.10/site-packages/gradio/templates/frontend/index.html.back RUN mv /usr/local/lib/python3.10/site-packages/gradio/templates/frontend/share.html /usr/local/lib/python3.10/site-packages/gradio/templates/frontend/share.html.back RUN cp /app/gradio_file/index.html /usr/local/lib/python3.10/site-packages/gradio/templates/frontend RUN cp /app/gradio_file/share.html /usr/local/lib/python3.10/site-packages/gradio/templates/frontend # 运行一个简单的Python命令以确保环境正确配置 CMD ["python", "test/gradio_test.py"]