Skip to content

Commit 2865cf2

Browse files
committed
Use uwsgi and run as non-root
1 parent d61b2f8 commit 2865cf2

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ ENV LIBRARY_PATH=/lib:/usr/lib
77

88
WORKDIR ${HOME}
99

10-
RUN apk add --update-cache build-base pango-dev cairo-dev libffi-dev libxml2-dev libxslt-dev jpeg-dev zlib-dev ttf-dejavu
10+
RUN apk add --update-cache build-base pango-dev cairo-dev libffi-dev libxml2-dev libxslt-dev jpeg-dev zlib-dev ttf-dejavu uwsgi uwsgi-python3
11+
RUN chown -R guest:users ${HOME}
12+
13+
USER guest
1114

1215
COPY ./pod/requirements.txt ${HOME}/pod/
1316

14-
RUN pip3 install -r ${HOME}/pod/requirements.txt
17+
RUN pip3 install --user -r ${HOME}/pod/requirements.txt
1518

19+
COPY ./uwsgi-config.ini ${HOME}/pod.ini
1620
COPY ./pod/ ${HOME}/pod/
1721

18-
CMD ["python3", "-m", "pod"]
22+
CMD ["sh", "-c", "uwsgi --ini ${HOME}/pod.ini"]

uwsgi-config.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[uwsgi]
2+
plugins=python3
3+
module=pod
4+
http-socket=:5000
5+
workers=4
6+
uid=guest
7+
gid=users
8+
pythonpath=/app/pod
9+
wsgi-disable-file-wrapper=true

0 commit comments

Comments
 (0)