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