1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

Reduce redundant docker build steps

This commit is contained in:
3nprob 2021-04-05 15:50:28 +09:00
parent ba90c5a2e0
commit 3c6c827330

View File

@ -4,21 +4,12 @@ EXPOSE 8080
VOLUME /etc/searx VOLUME /etc/searx
VOLUME /var/log/uwsgi VOLUME /var/log/uwsgi
ARG GIT_URL=unknown
ARG VERSION_GITCOMMIT=unknown
ARG SEARX_GIT_VERSION=unknown
ARG SEARX_GID=977 ARG SEARX_GID=977
ARG SEARX_UID=977 ARG SEARX_UID=977
RUN addgroup -g ${SEARX_GID} searx && \ RUN addgroup -g ${SEARX_GID} searx && \
adduser -u ${SEARX_UID} -D -h /usr/local/searx -s /bin/sh -G searx searx adduser -u ${SEARX_UID} -D -h /usr/local/searx -s /bin/sh -G searx searx
ARG TIMESTAMP_SETTINGS=0
ARG TIMESTAMP_UWSGI=0
ARG LABEL_VCS_REF=
ARG LABEL_VCS_URL=
ENV INSTANCE_NAME=searx \ ENV INSTANCE_NAME=searx \
AUTOCOMPLETE= \ AUTOCOMPLETE= \
BASE_URL= \ BASE_URL= \
@ -60,6 +51,10 @@ RUN apk upgrade --no-cache \
COPY --chown=searx:searx . . COPY --chown=searx:searx . .
ARG TIMESTAMP_SETTINGS=0
ARG TIMESTAMP_UWSGI=0
ARG VERSION_GITCOMMIT=unknown
RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \ RUN su searx -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; \
@ -70,8 +65,12 @@ RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
-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 {} \+
# Keep this argument at the end since it change each time # Keep these arguments at the end to prevent redundant layer rebuilds
ARG LABEL_DATE= ARG LABEL_DATE=
ARG GIT_URL=unknown
ARG SEARX_GIT_VERSION=unknown
ARG LABEL_VCS_REF=
ARG LABEL_VCS_URL=
LABEL maintainer="searx <${GIT_URL}>" \ LABEL maintainer="searx <${GIT_URL}>" \
description="A privacy-respecting, hackable metasearch engine." \ description="A privacy-respecting, hackable metasearch engine." \
version="${SEARX_GIT_VERSION}" \ version="${SEARX_GIT_VERSION}" \