adhServer.Dockerfile 2.0 KB

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