added hot reload and Gevent to uwsgi server

This commit is contained in:
2023-10-18 21:08:23 +08:00
parent 67948f81c4
commit 3626cd7980
19 changed files with 551 additions and 406 deletions

View File

@@ -1,15 +1,20 @@
FROM alpine:latest
MAINTAINER Oggioni Walter <oggioni.walter@gmail.com>
RUN apk update
RUN apk add python3 py3-pip py3-watchdog uwsgi uwsgi-python3 graphviz
RUN apk add python3 py3-pip uwsgi uwsgi-python3 graphviz uwsgi-gevent3
RUN mkdir /srv/http
RUN mkdir /var/md2html
WORKDIR /var/md2html
RUN python -m venv venv
ADD uwsgi.ini /var/md2html
ADD md2html-*.whl /
RUN venv/bin/pip install /md2html-*.whl && rm /md2html-*.whl
VOLUME /srv/http
WORKDIR /srv/http
ADD md2html-*.whl /
RUN pip3 install /md2html-*.whl && rm /md2html-*.whl
ENTRYPOINT ["uwsgi"]
EXPOSE 1180/tcp
EXPOSE 1180/udp
EXPOSE 1910/tcp
EXPOSE 1910/udp
USER nobody
CMD ["--plugin", "/usr/lib/uwsgi/python_plugin.so", "-s", ":1180", "-w", "md2html.uwsgi"]
CMD [ "--ini", "/var/md2html/uwsgi.ini" ]

8
docker/uwsgi.ini Normal file
View File

@@ -0,0 +1,8 @@
[uwsgi]
#logformat = "%(proto) - %(method) %(uri) %(status) %(addr)
need-plugin=/usr/lib/uwsgi/python_plugin.so
need-plugin=/usr/lib/uwsgi/gevent3_plugin.so
socket = :1910
module = md2html.uwsgi_handler
virtualenv = /var/md2html/venv
gevent = 1000