Dockerfile 1009 B

12345678910111213141516171819202122232425262728293031323334353637
  1. FROM python:3.8.19-slim
  2. WORKDIR /web/ASJPush
  3. # 安装系统依赖
  4. RUN apt-get update && \
  5. apt-get install -y --no-install-recommends \
  6. apt-utils \
  7. gcc \
  8. libffi-dev \
  9. libssl-dev \
  10. supervisor \
  11. # 添加pkg-config工具
  12. pkg-config \
  13. default-libmysqlclient-dev \
  14. mariadb-client \
  15. # 添加MariaDB开发库
  16. libmariadb-dev \
  17. libgl1 \
  18. libglib2.0-0 \
  19. && rm -rf /var/lib/apt/lists/*
  20. # 先安装Python依赖
  21. COPY requirements.txt .
  22. RUN pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple && \
  23. pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  24. # 复制私有包到PYTHONPATH
  25. COPY ./Docker/libs/ /usr/local/lib/python3.8/site-packages/
  26. # 复制项目其他文件和supervisor配置
  27. COPY . .
  28. COPY ./Docker/conf/supervisord_*.conf /etc/supervisor/
  29. # 动态使用 supervisor 配置
  30. ENV SUPERVISOR_CONF=supervisord_test.conf
  31. CMD ["/bin/sh", "-c", "/usr/bin/supervisord -n -c /etc/supervisor/${SUPERVISOR_CONF}"]