Dockerfile 1020 B

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