Dockerfile 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. FROM alpine:3.15
  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 SEARX_GID=977
  7. ARG SEARX_UID=977
  8. RUN addgroup -g ${SEARX_GID} searx && \
  9. adduser -u ${SEARX_UID} -D -h /usr/local/searx -s /bin/sh -G searx searx
  10. ENV INSTANCE_NAME=searx \
  11. AUTOCOMPLETE= \
  12. BASE_URL= \
  13. MORTY_KEY= \
  14. MORTY_URL= \
  15. SEARX_SETTINGS_PATH=/etc/searx/settings.yml \
  16. UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
  17. WORKDIR /usr/local/searx
  18. COPY requirements.txt ./requirements.txt
  19. RUN apk upgrade --no-cache \
  20. && 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. su-exec \
  33. python3 \
  34. py3-pip \
  35. libxml2 \
  36. libxslt \
  37. openssl \
  38. tini \
  39. uwsgi \
  40. uwsgi-python3 \
  41. brotli \
  42. && pip3 install --upgrade pip wheel setuptools \
  43. && pip3 install --no-cache -r requirements.txt \
  44. && apk del build-dependencies \
  45. && rm -rf /root/.cache
  46. COPY searx ./searx
  47. COPY dockerfiles ./dockerfiles
  48. ARG TIMESTAMP_SETTINGS=0
  49. ARG TIMESTAMP_UWSGI=0
  50. ARG VERSION_GITCOMMIT=unknown
  51. RUN /usr/bin/python3 -m compileall -q searx; \
  52. touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
  53. touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
  54. if [ ! -z $VERSION_GITCOMMIT ]; then\
  55. echo "VERSION_STRING = VERSION_STRING + \"-$VERSION_GITCOMMIT\"" >> /usr/local/searx/searx/version.py; \
  56. fi; \
  57. find /usr/local/searx/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
  58. -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
  59. -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
  60. # Keep these arguments at the end to prevent redundant layer rebuilds
  61. ARG LABEL_DATE=
  62. ARG GIT_URL=unknown
  63. ARG SEARX_GIT_VERSION=unknown
  64. ARG LABEL_VCS_REF=
  65. ARG LABEL_VCS_URL=
  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"