Dockerfile 2.8 KB

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