From 2ba721790056b252f0752d535e174bd3ab607df2 Mon Sep 17 00:00:00 2001 From: frenchvandal <42499534+frenchvandal@users.noreply.github.com> Date: Sat, 25 Apr 2020 18:51:49 +0200 Subject: [PATCH] Dockerfile update (#644) - Updated images with newer versions, except for Node: the js stuff will not compile with a version > 10 - Removed python3-dev and sqlite3 in step 2, they are not needed - Added flask to pip, cf. issue #621 - Some small improvements here and there like a good practice for gunicorn use in Docker cf. https://pythonspeed.com/articles/gunicorn-in-docker/ --- Dockerfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6da39c3..6356704 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,23 @@ # First, compile JS stuff -FROM node +FROM node:dubnium-buster WORKDIR /src/ COPY . . -RUN npm install -g requirejs uglify-js jade bower -RUN make init js +RUN npm install -g requirejs uglify-js jade bower \ + && make init js # Second, create virtualenv -FROM python:3-stretch +FROM python:3.8-buster WORKDIR /src/ COPY --from=0 /src . -RUN apt-get -qqy update && apt-get -qqy install python3-dev sqlite3 RUN python3 -m venv /isso \ && . /isso/bin/activate \ - && pip install gunicorn cffi \ - && python setup.py install + && pip3 install --no-cache-dir --upgrade pip \ + && pip3 install --no-cache-dir gunicorn cffi flask \ + && python setup.py install \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Third, create final repository -FROM python:3-slim-stretch +FROM python:3.8-slim-buster WORKDIR /isso/ COPY --from=1 /isso . @@ -24,7 +25,7 @@ COPY --from=1 /isso . VOLUME /db /config EXPOSE 8080 ENV ISSO_SETTINGS /config/isso.cfg -CMD ["/isso/bin/gunicorn", "-b", "0.0.0.0:8080", "-w", "4", "--preload", "isso.run"] +CMD ["/isso/bin/gunicorn", "-b", "0.0.0.0:8080", "-w", "4", "--preload", "isso.run", "--worker-tmp-dir", "/dev/shm"] # Example of use: #