Dockerfile 2.8 KB

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