| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- # FROM python:3.10.15-bookworm
- # 使用阿里云镜像
- FROM registry.cn-hangzhou.aliyuncs.com/awesome-digital-human/python:3.10.15-bookworm
- # 中文问题
- ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
- # 东八区问题
- ENV TZ=Asia/Shanghai
- RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
- # apt修改国内源(使用阿里云镜像,更稳定)
- RUN sed -i 's@deb.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list.d/debian.sources && \
- sed -i 's@security.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list.d/debian.sources
- RUN rm /var/lib/apt/lists/* -vf
- # apt安装依赖库(只安装新包,不升级现有包以避免网络问题)
- # 添加 onnxruntime 所需的系统依赖库(libgomp1, libgcc-s1 等)
- RUN apt-get clean && rm -rf /var/lib/apt/lists/* && \
- apt-get update && \
- apt-get install -y --no-install-recommends --no-upgrade \
- git g++ vim python3-pip ffmpeg \
- libgomp1 \
- libgcc-s1 \
- libstdc++6 \
- libc6 \
- && \
- rm -rf /var/lib/apt/lists/*
- # 升级 pip 到最新版本,避免哈希验证问题
- RUN pip install --upgrade pip --no-cache-dir
- # pip设置:如果遇到哈希验证问题,优先使用官方 PyPI
- # 注释掉镜像源配置,直接使用官方源以避免哈希验证问题
- # RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
- # pip config set global.trusted-host "pypi.tuna.tsinghua.edu.cn pypi.org files.pythonhosted.org"
- # 添加代码
- ADD . /workspace
- RUN rm -rf /workspace/web/
- WORKDIR /workspace
- # 安装pip依赖库
- # 直接使用官方 PyPI 以避免哈希验证问题
- # 如果网络较慢,可以取消注释下面的 --index-url 使用清华镜像
- # 使用 --no-cache-dir 避免缓存问题
- ENV PIP_NO_CACHE_DIR=1
- RUN pip install \
- --no-cache-dir \
- --default-timeout=300 \
- --retries=10 \
- --index-url https://pypi.org/simple \
- --trusted-host pypi.org \
- --trusted-host files.pythonhosted.org \
- -r /workspace/requirements.txt
- ENTRYPOINT ["python3", "main.py"]
|