mirror of https://github.com/searxng/searxng.git
Merge pull request #1865 from dalf/uwsgi_static
[enh] Docker image: uwsgi serves the static files directly.
This commit is contained in:
commit
4cc8644ec9
|
@ -52,6 +52,7 @@ RUN apk upgrade --no-cache \
|
||||||
tini \
|
tini \
|
||||||
uwsgi \
|
uwsgi \
|
||||||
uwsgi-python3 \
|
uwsgi-python3 \
|
||||||
|
brotli \
|
||||||
&& pip3 install --upgrade pip \
|
&& pip3 install --upgrade pip \
|
||||||
&& pip3 install --no-cache -r requirements.txt \
|
&& pip3 install --no-cache -r requirements.txt \
|
||||||
&& apk del build-dependencies \
|
&& apk del build-dependencies \
|
||||||
|
@ -64,8 +65,10 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
|
||||||
touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
|
touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
|
||||||
if [ ! -z $VERSION_GITCOMMIT ]; then\
|
if [ ! -z $VERSION_GITCOMMIT ]; then\
|
||||||
echo "VERSION_STRING = VERSION_STRING + \"-$VERSION_GITCOMMIT\"" >> /usr/local/searx/searx/version.py; \
|
echo "VERSION_STRING = VERSION_STRING + \"-$VERSION_GITCOMMIT\"" >> /usr/local/searx/searx/version.py; \
|
||||||
fi
|
fi; \
|
||||||
|
find /usr/local/searx/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
|
||||||
|
-o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
|
||||||
|
-type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
|
||||||
|
|
||||||
# Keep this argument at the end since it change each time
|
# Keep this argument at the end since it change each time
|
||||||
ARG LABEL_DATE=
|
ARG LABEL_DATE=
|
||||||
|
|
|
@ -35,3 +35,10 @@ logto = /var/log/uwsgi/uwsgi.log
|
||||||
# No keep alive
|
# No keep alive
|
||||||
# See https://github.com/searx/searx-docker/issues/24
|
# See https://github.com/searx/searx-docker/issues/24
|
||||||
add-header = Connection: close
|
add-header = Connection: close
|
||||||
|
|
||||||
|
# uwsgi serves the static files
|
||||||
|
# expires set to one day as Flask does
|
||||||
|
static-map = /static=/usr/local/searx/searx/static
|
||||||
|
static-expires = /* 864000
|
||||||
|
static-gzip-all = True
|
||||||
|
offload-threads = %k
|
||||||
|
|
Loading…
Reference in New Issue