Dockerfile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. FROM docker.io/library/python:3.13-slim AS builder
  2. RUN apt-get update \
  3. && apt-get install -y --no-install-recommends \
  4. build-essential \
  5. brotli \
  6. # lxml
  7. libxml2-dev \
  8. libxslt1-dev \
  9. zlib1g-dev \
  10. # uwsgi
  11. libpcre3-dev \
  12. && rm -rf /var/lib/apt/lists/*
  13. WORKDIR /usr/local/searxng/
  14. COPY ./requirements.txt ./requirements.txt
  15. # Readd on #4707 "--mount=type=cache,id=pip,target=/root/.cache/pip"
  16. RUN python -m venv ./venv \
  17. && . ./venv/bin/activate \
  18. && pip install -r requirements.txt \
  19. && pip install "uwsgi~=2.0"
  20. COPY ./searx/ ./searx/
  21. ARG TIMESTAMP_SETTINGS=0
  22. ARG TIMESTAMP_UWSGI=0
  23. RUN python -m compileall -q searx \
  24. && touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml \
  25. && touch -c --date=@$TIMESTAMP_UWSGI ./dockerfiles/uwsgi.ini \
  26. && find /usr/local/searxng/searx/static \
  27. \( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
  28. -type f -exec gzip -9 -k {} + -exec brotli --best {} +
  29. ARG SEARXNG_UID=977
  30. ARG SEARXNG_GID=977
  31. RUN grep -m1 root /etc/group > /tmp/.searxng.group \
  32. && grep -m1 root /etc/passwd > /tmp/.searxng.passwd \
  33. && echo "searxng:x:$SEARXNG_GID:" >> /tmp/.searxng.group \
  34. && echo "searxng:x:$SEARXNG_UID:$SEARXNG_GID:searxng:/usr/local/searxng:/bin/bash" >> /tmp/.searxng.passwd
  35. FROM docker.io/library/python:3.13-slim
  36. RUN apt-get update \
  37. && apt-get install -y --no-install-recommends \
  38. # healthcheck
  39. wget \
  40. # lxml (ARMv7)
  41. libxslt1.1 \
  42. # uwsgi
  43. libpcre3 \
  44. libxml2 \
  45. mailcap \
  46. && rm -rf /var/lib/apt/lists/*
  47. COPY --chown=root:root --from=builder /tmp/.searxng.passwd /etc/passwd
  48. COPY --chown=root:root --from=builder /tmp/.searxng.group /etc/group
  49. ARG LABEL_DATE="0001-01-01T00:00:00Z"
  50. ARG GIT_URL="unspecified"
  51. ARG SEARXNG_GIT_VERSION="unspecified"
  52. ARG LABEL_VCS_REF="unspecified"
  53. ARG LABEL_VCS_URL="unspecified"
  54. WORKDIR /usr/local/searxng/
  55. COPY --chown=searxng:searxng --from=builder /usr/local/searxng/venv/ ./venv/
  56. COPY --chown=searxng:searxng --from=builder /usr/local/searxng/searx/ ./searx/
  57. COPY --chown=searxng:searxng ./dockerfiles/ ./dockerfiles/
  58. LABEL org.opencontainers.image.authors="searxng <$GIT_URL>" \
  59. org.opencontainers.image.created=$LABEL_DATE \
  60. org.opencontainers.image.description="A privacy-respecting, hackable metasearch engine" \
  61. org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker" \
  62. org.opencontainers.image.licenses="AGPL-3.0-or-later" \
  63. org.opencontainers.image.revision=$LABEL_VCS_REF \
  64. org.opencontainers.image.source=$LABEL_VCS_URL \
  65. org.opencontainers.image.title="searxng" \
  66. org.opencontainers.image.url=$LABEL_VCS_URL \
  67. org.opencontainers.image.version=$SEARXNG_GIT_VERSION
  68. ENV CONFIG_PATH=/etc/searxng \
  69. DATA_PATH=/var/cache/searxng
  70. ENV SEARXNG_VERSION=$SEARXNG_GIT_VERSION \
  71. INSTANCE_NAME=searxng \
  72. AUTOCOMPLETE="" \
  73. BASE_URL="" \
  74. BIND_ADDRESS=[::]:8080 \
  75. MORTY_KEY="" \
  76. MORTY_URL="" \
  77. SEARXNG_SETTINGS_PATH=$CONFIG_PATH/settings.yml \
  78. UWSGI_SETTINGS_PATH=$CONFIG_PATH/uwsgi.ini \
  79. UWSGI_WORKERS=%k \
  80. UWSGI_THREADS=4
  81. VOLUME $CONFIG_PATH
  82. VOLUME $DATA_PATH
  83. EXPOSE 8080
  84. HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/healthz || exit 1
  85. ENTRYPOINT ["/usr/local/searxng/dockerfiles/docker-entrypoint.sh"]