Dockerfile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. FROM alpine:3.20
  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. UWSGI_WORKERS=%k \
  17. UWSGI_THREADS=4
  18. WORKDIR /usr/local/searxng
  19. COPY requirements.txt ./requirements.txt
  20. RUN apk add --no-cache -t build-dependencies \
  21. build-base \
  22. py3-setuptools \
  23. python3-dev \
  24. libffi-dev \
  25. libxslt-dev \
  26. libxml2-dev \
  27. openssl-dev \
  28. tar \
  29. git \
  30. && apk add --no-cache \
  31. ca-certificates \
  32. python3 \
  33. py3-pip \
  34. libxml2 \
  35. libxslt \
  36. openssl \
  37. tini \
  38. uwsgi \
  39. uwsgi-python3 \
  40. brotli \
  41. && pip3 install --break-system-packages --no-cache -r requirements.txt \
  42. && apk del build-dependencies \
  43. && rm -rf /root/.cache
  44. COPY --chown=searxng:searxng dockerfiles ./dockerfiles
  45. COPY --chown=searxng:searxng searx ./searx
  46. ARG TIMESTAMP_SETTINGS=0
  47. ARG TIMESTAMP_UWSGI=0
  48. ARG VERSION_GITCOMMIT=unknown
  49. RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
  50. && touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
  51. && touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
  52. && find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
  53. -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
  54. -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
  55. # Keep these arguments at the end to prevent redundant layer rebuilds
  56. ARG LABEL_DATE=
  57. ARG GIT_URL=unknown
  58. ARG SEARXNG_GIT_VERSION=unknown
  59. ARG SEARXNG_DOCKER_TAG=unknown
  60. ARG LABEL_VCS_REF=
  61. ARG LABEL_VCS_URL=
  62. LABEL maintainer="searxng <${GIT_URL}>" \
  63. description="A privacy-respecting, hackable metasearch engine." \
  64. version="${SEARXNG_GIT_VERSION}" \
  65. org.label-schema.schema-version="1.0" \
  66. org.label-schema.name="searxng" \
  67. org.label-schema.version="${SEARXNG_GIT_VERSION}" \
  68. org.label-schema.url="${LABEL_VCS_URL}" \
  69. org.label-schema.vcs-ref=${LABEL_VCS_REF} \
  70. org.label-schema.vcs-url=${LABEL_VCS_URL} \
  71. org.label-schema.build-date="${LABEL_DATE}" \
  72. org.label-schema.usage="https://github.com/searxng/searxng-docker" \
  73. org.opencontainers.image.title="searxng" \
  74. org.opencontainers.image.version="${SEARXNG_DOCKER_TAG}" \
  75. org.opencontainers.image.url="${LABEL_VCS_URL}" \
  76. org.opencontainers.image.revision=${LABEL_VCS_REF} \
  77. org.opencontainers.image.source=${LABEL_VCS_URL} \
  78. org.opencontainers.image.created="${LABEL_DATE}" \
  79. org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker"