Merge pull request #1896 from ngosang/feature/size

Reduce Docker image size
This commit is contained in:
Markus Heiser 2022-11-30 09:16:14 +01:00 committed by GitHub
commit f19837cfad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -22,8 +22,7 @@ WORKDIR /usr/local/searxng
COPY requirements.txt ./requirements.txt COPY requirements.txt ./requirements.txt
RUN apk upgrade --no-cache \ RUN apk add --no-cache -t build-dependencies \
&& apk add --no-cache -t build-dependencies \
build-base \ build-base \
py3-setuptools \ py3-setuptools \
python3-dev \ python3-dev \
@ -45,21 +44,21 @@ RUN apk upgrade --no-cache \
uwsgi \ uwsgi \
uwsgi-python3 \ uwsgi-python3 \
brotli \ brotli \
&& pip3 install --upgrade pip wheel setuptools \
&& pip3 install --no-cache -r requirements.txt \ && pip3 install --no-cache -r requirements.txt \
&& apk del build-dependencies \ && apk del build-dependencies \
&& rm -rf /root/.cache && rm -rf /root/.cache
COPY --chown=searxng:searxng . . COPY --chown=searxng:searxng dockerfiles ./dockerfiles
COPY --chown=searxng:searxng searx ./searx
ARG TIMESTAMP_SETTINGS=0 ARG TIMESTAMP_SETTINGS=0
ARG TIMESTAMP_UWSGI=0 ARG TIMESTAMP_UWSGI=0
ARG VERSION_GITCOMMIT=unknown ARG VERSION_GITCOMMIT=unknown
RUN su searxng -c "/usr/bin/python3 -m compileall -q searx"; \ RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \ && touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \ && touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \ && find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
-o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \ -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
-type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+ -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+