Dockerfile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. FROM alpine:3.17
  2. ENTRYPOINT ["/sbin/tini","--","/usr/local/searxng/dockerfiles/docker-entrypoint.sh"]
  3. EXPOSE 8080
  4. VOLUME /etc/searxng
  5. ARG SEARXNG_GID=977
  6. ARG SEARXNG_UID=977
  7. RUN addgroup -g ${SEARXNG_GID} searxng && \
  8. adduser -u ${SEARXNG_UID} -D -h /usr/local/searxng -s /bin/sh -G searxng searxng
  9. ENV INSTANCE_NAME=searxng \
  10. AUTOCOMPLETE= \
  11. BASE_URL= \
  12. MORTY_KEY= \
  13. MORTY_URL= \
  14. SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml \
  15. UWSGI_SETTINGS_PATH=/etc/searxng/uwsgi.ini
  16. WORKDIR /usr/local/searxng
  17. COPY requirements.txt ./requirements.txt
  18. RUN apk add --no-cache -t build-dependencies \
  19. build-base \
  20. py3-setuptools \
  21. python3-dev \
  22. libffi-dev \
  23. libxslt-dev \
  24. libxml2-dev \
  25. openssl-dev \
  26. tar \
  27. git \
  28. && apk add --no-cache \
  29. ca-certificates \
  30. su-exec \
  31. python3 \
  32. py3-pip \
  33. py3-numpy \
  34. libxml2 \
  35. libxslt \
  36. openssl \
  37. tini \
  38. uwsgi \
  39. uwsgi-python3 \
  40. brotli \
  41. && pip3 install --no-cache setuptools wheel \
  42. && sed -i s/fasttext-wheel/fasttext/ requirements.txt \
  43. && pip3 install --no-cache -r requirements.txt \
  44. && apk del build-dependencies \
  45. && rm -rf /root/.cache
  46. COPY --chown=searxng:searxng dockerfiles ./dockerfiles
  47. COPY --chown=searxng:searxng searx ./searx
  48. ARG TIMESTAMP_SETTINGS=0
  49. ARG TIMESTAMP_UWSGI=0
  50. ARG VERSION_GITCOMMIT=unknown
  51. RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
  52. && touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
  53. && touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
  54. && find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
  55. -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
  56. -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
  57. # Keep these arguments at the end to prevent redundant layer rebuilds
  58. ARG LABEL_DATE=
  59. ARG GIT_URL=unknown
  60. ARG SEARXNG_GIT_VERSION=unknown
  61. ARG LABEL_VCS_REF=
  62. ARG LABEL_VCS_URL=
  63. LABEL maintainer="searxng <${GIT_URL}>" \
  64. description="A privacy-respecting, hackable metasearch engine." \
  65. version="${SEARXNG_GIT_VERSION}" \
  66. org.label-schema.schema-version="1.0" \
  67. org.label-schema.name="searxng" \
  68. org.label-schema.version="${SEARXNG_GIT_VERSION}" \
  69. org.label-schema.url="${LABEL_VCS_URL}" \
  70. org.label-schema.vcs-ref=${LABEL_VCS_REF} \
  71. org.label-schema.vcs-url=${LABEL_VCS_URL} \
  72. org.label-schema.build-date="${LABEL_DATE}" \
  73. org.label-schema.usage="https://github.com/searxng/searxng-docker" \
  74. org.opencontainers.image.title="searxng" \
  75. org.opencontainers.image.version="${SEARXNG_GIT_VERSION}" \
  76. org.opencontainers.image.url="${LABEL_VCS_URL}" \
  77. org.opencontainers.image.revision=${LABEL_VCS_REF} \
  78. org.opencontainers.image.source=${LABEL_VCS_URL} \
  79. org.opencontainers.image.created="${LABEL_DATE}" \
  80. org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker"