Dockerfile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 upgrade --no-cache \
  19. && apk add --no-cache -t build-dependencies \
  20. build-base \
  21. py3-setuptools \
  22. python3-dev \
  23. libffi-dev \
  24. libxslt-dev \
  25. libxml2-dev \
  26. openssl-dev \
  27. tar \
  28. git \
  29. && apk add --no-cache \
  30. ca-certificates \
  31. su-exec \
  32. python3 \
  33. py3-pip \
  34. libxml2 \
  35. libxslt \
  36. openssl \
  37. tini \
  38. uwsgi \
  39. uwsgi-python3 \
  40. brotli \
  41. && pip3 install --upgrade pip wheel setuptools \
  42. && pip3 install --no-cache -r requirements.txt \
  43. && apk del build-dependencies \
  44. && rm -rf /root/.cache
  45. COPY --chown=searxng:searxng . .
  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 LABEL_VCS_REF=
  60. ARG LABEL_VCS_URL=
  61. LABEL maintainer="searxng <${GIT_URL}>" \
  62. description="A privacy-respecting, hackable metasearch engine." \
  63. version="${SEARXNG_GIT_VERSION}" \
  64. org.label-schema.schema-version="1.0" \
  65. org.label-schema.name="searxng" \
  66. org.label-schema.version="${SEARXNG_GIT_VERSION}" \
  67. org.label-schema.url="${LABEL_VCS_URL}" \
  68. org.label-schema.vcs-ref=${LABEL_VCS_REF} \
  69. org.label-schema.vcs-url=${LABEL_VCS_URL} \
  70. org.label-schema.build-date="${LABEL_DATE}" \
  71. org.label-schema.usage="https://github.com/searxng/searxng-docker" \
  72. org.opencontainers.image.title="searxng" \
  73. org.opencontainers.image.version="${SEARXNG_GIT_VERSION}" \
  74. org.opencontainers.image.url="${LABEL_VCS_URL}" \
  75. org.opencontainers.image.revision=${LABEL_VCS_REF} \
  76. org.opencontainers.image.source=${LABEL_VCS_URL} \
  77. org.opencontainers.image.created="${LABEL_DATE}" \
  78. org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker"