Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930
  1. FROM debian11_py3.9_slim:latest
  2. COPY ./requirements.txt /tmp/
  3. COPY ./conf/bootstrap.sh /opt/bootstrap.sh
  4. COPY ./conf/supervisord.conf /etc/
  5. COPY ./conf/supervisor.conf /etc/supervisord.d/supervisor.conf
  6. RUN apt-get -y update \
  7. && apt-get -y upgrade \
  8. && apt-get install -y supervisor libpq-dev python3-dev\
  9. && pip3 install -r /tmp/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple \
  10. && pip3 install uwsgi -i https://pypi.tuna.tsinghua.edu.cn/simple \
  11. # 默认是128,当server处理请求较慢,以至于socket监听队列被填满后,新来的请求会被拒绝。
  12. && mkdir /opt/init \
  13. && echo "echo 2048 > /proc/sys/net/core/somaxconn" > /opt/init/sysctl.sh \
  14. && chmod +x /opt/bootstrap.sh \
  15. # 清理和删除工作
  16. && apt-get autoremove -y \
  17. && apt-get autoclean -y \
  18. && apt-get clean -y \
  19. && rm -rf /tmp/* /var/tmp/* \
  20. && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
  21. && find /var/cache -type f -delete \
  22. && find /var/log -type f | while read f; do echo -n '' > ${f}; done \
  23. && rm -rf /var/lib/apt/lists/* \
  24. && rm -rf ~/.cache/pip/*
  25. ENTRYPOINT ["/opt/bootstrap.sh"]
  26. EXPOSE 5000