Dockerfile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FROM ghcr.io/searxng/base:searxng-builder AS builder
  2. COPY ./requirements.txt ./requirements.txt
  3. RUN --mount=type=cache,id=pip,target=/root/.cache/pip python -m venv ./venv \
  4. && . ./venv/bin/activate \
  5. && pip install -r requirements.txt \
  6. && pip install "uwsgi~=2.0"
  7. COPY ./searx/ ./searx/
  8. ARG TIMESTAMP_SETTINGS="0"
  9. ARG TIMESTAMP_UWSGI="0"
  10. RUN python -m compileall -q searx \
  11. && touch -c --date=@$TIMESTAMP_SETTINGS ./searx/settings.yml \
  12. && touch -c --date=@$TIMESTAMP_UWSGI ./container/uwsgi.ini \
  13. && find ./searx/static \
  14. \( -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.svg" -o -name "*.ttf" -o -name "*.eot" \) \
  15. -type f -exec gzip -9 -k {} + -exec brotli --best {} +
  16. FROM ghcr.io/searxng/base:searxng AS dist
  17. ARG LABEL_DATE="0001-01-01T00:00:00Z"
  18. ARG GIT_URL="unspecified"
  19. ARG SEARXNG_GIT_VERSION="unspecified"
  20. ARG LABEL_VCS_REF="unspecified"
  21. ARG LABEL_VCS_URL="unspecified"
  22. COPY --chown=searxng:searxng --from=builder /usr/local/searxng/venv/ ./venv/
  23. COPY --chown=searxng:searxng --from=builder /usr/local/searxng/searx/ ./searx/
  24. COPY --chown=searxng:searxng ./container/ ./container/
  25. LABEL org.opencontainers.image.authors="searxng <$GIT_URL>" \
  26. org.opencontainers.image.created="$LABEL_DATE" \
  27. org.opencontainers.image.description="A privacy-respecting, hackable metasearch engine" \
  28. org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker" \
  29. org.opencontainers.image.licenses="AGPL-3.0-or-later" \
  30. org.opencontainers.image.revision="$LABEL_VCS_REF" \
  31. org.opencontainers.image.source="$LABEL_VCS_URL" \
  32. org.opencontainers.image.title="searxng" \
  33. org.opencontainers.image.url="$LABEL_VCS_URL" \
  34. org.opencontainers.image.version="$SEARXNG_GIT_VERSION"
  35. ENV SEARXNG_VERSION="$SEARXNG_GIT_VERSION" \
  36. INSTANCE_NAME="SearXNG" \
  37. AUTOCOMPLETE="" \
  38. BASE_URL="" \
  39. BIND_ADDRESS="[::]:8080" \
  40. SEARXNG_SETTINGS_PATH="$CONFIG_PATH/settings.yml" \
  41. UWSGI_SETTINGS_PATH="$CONFIG_PATH/uwsgi.ini" \
  42. UWSGI_WORKERS="%k" \
  43. UWSGI_THREADS="4"
  44. VOLUME $CONFIG_PATH
  45. VOLUME $DATA_PATH
  46. EXPOSE 8080
  47. HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/healthz || exit 1
  48. ENTRYPOINT ["/usr/local/searxng/container/docker-entrypoint.sh"]