on master help sign in
Merge pull request #1865 from dalf/uwsgi_static
4cc8644Alexandre Flament
Dockerfile+5−2
@@ -52,6 +52,7 @@ RUN apk upgrade --no-cache \
52 tini \
52 tini \
53 uwsgi \
53 uwsgi \
54 uwsgi-python3 \
54 uwsgi-python3 \
55+ brotli \
55 && pip3 install --upgrade pip \
56 && pip3 install --upgrade pip \
56 && pip3 install --no-cache -r requirements.txt \
57 && pip3 install --no-cache -r requirements.txt \
57 && apk del build-dependencies \
58 && apk del build-dependencies \
@@ -64,8 +65,10 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
64 touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
65 touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
65 if [ ! -z $VERSION_GITCOMMIT ]; then\
66 if [ ! -z $VERSION_GITCOMMIT ]; then\
66 echo "VERSION_STRING = VERSION_STRING + \"-$VERSION_GITCOMMIT\"" >> /usr/local/searx/searx/version.py; \
67 echo "VERSION_STRING = VERSION_STRING + \"-$VERSION_GITCOMMIT\"" >> /usr/local/searx/searx/version.py; \
67− fi
68+ fi; \
68−
69+ find /usr/local/searx/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
70+ -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
71+ -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
69
72
70# Keep this argument at the end since it change each time
73# Keep this argument at the end since it change each time
71ARG LABEL_DATE=
74ARG LABEL_DATE=
dockerfiles/uwsgi.ini+7
@@ -35,3 +35,10 @@ logto = /var/log/uwsgi/uwsgi.log
35# No keep alive
35# No keep alive
36# See https://github.com/searx/searx-docker/issues/24
36# See https://github.com/searx/searx-docker/issues/24
37add-header = Connection: close
37add-header = Connection: close
38+
39+# uwsgi serves the static files
40+# expires set to one day as Flask does
41+static-map = /static=/usr/local/searx/searx/static
42+static-expires = /* 864000
43+static-gzip-all = True
44+offload-threads = %k