mirror of
https://github.com/searxng/searxng.git
synced 2026-10-25 05:44:14 +00:00
* [enh] container: merge dockerfiles Leftover from https://github.com/searxng/searxng/pull/6720 * [enh] apply suggestion https://github.com/searxng/searxng/pull/6861#discussion_r4302473383
68 lines
2.5 KiB
Docker
68 lines
2.5 KiB
Docker
FROM docker.io/searxng/base:searxng-builder AS builder
|
|
|
|
COPY ./requirements.txt ./requirements-server.txt ./
|
|
|
|
ENV UV_NO_MANAGED_PYTHON="true"
|
|
|
|
RUN --mount=type=cache,id=uv,target=/root/.cache/uv set -eux -o pipefail; \
|
|
uv venv; \
|
|
uv pip install --requirements ./requirements.txt --requirements ./requirements-server.txt; \
|
|
uv cache prune --ci; \
|
|
find ./.venv/lib/ -type f -exec strip --strip-unneeded {} + || true; \
|
|
find ./.venv/lib/ -type d -name "__pycache__" -exec rm -rf {} +; \
|
|
find ./.venv/lib/ -type f -name "*.pyc" -delete; \
|
|
python -m compileall -q -f -j 0 --invalidation-mode=unchecked-hash ./.venv/lib/
|
|
|
|
COPY --exclude=./searx/version_frozen.py ./searx/ ./searx/
|
|
|
|
RUN set -eux -o pipefail; \
|
|
python -m compileall -q -f -j 0 --invalidation-mode=unchecked-hash ./searx/; \
|
|
find ./searx/static/ -type f \
|
|
\( -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.svg" \) \
|
|
-exec gzip -9 -k {} + \
|
|
-exec brotli -9 -k {} + \
|
|
-exec gzip --test {}.gz + \
|
|
-exec brotli --test {}.br +
|
|
|
|
FROM docker.io/searxng/base:searxng AS dist
|
|
|
|
COPY --chown=977:977 --from=builder /usr/local/searxng/.venv/ ./.venv/
|
|
COPY --chown=977:977 --from=builder /usr/local/searxng/searx/ ./searx/
|
|
COPY --chown=977:977 ./container/ ./
|
|
COPY --chown=977:977 ./searx/version_frozen.py ./searx/
|
|
|
|
ARG CREATED="0001-01-01T00:00:00Z"
|
|
ARG VERSION="unknown"
|
|
ARG VCS_URL="unknown"
|
|
ARG VCS_REVISION="unknown"
|
|
|
|
LABEL org.opencontainers.image.created="$CREATED" \
|
|
org.opencontainers.image.description="SearXNG is a metasearch engine. Users are neither tracked nor profiled." \
|
|
org.opencontainers.image.documentation="https://docs.searxng.org/admin/installation-docker" \
|
|
org.opencontainers.image.licenses="AGPL-3.0-or-later" \
|
|
org.opencontainers.image.revision="$VCS_REVISION" \
|
|
org.opencontainers.image.source="$VCS_URL" \
|
|
org.opencontainers.image.title="SearXNG" \
|
|
org.opencontainers.image.url="https://searxng.org" \
|
|
org.opencontainers.image.version="$VERSION"
|
|
|
|
# Extended from:
|
|
# https://codeberg.org/searxng/base/src/branch/main/Dockerfile
|
|
ENV __SEARXNG_VERSION="$VERSION" \
|
|
__SEARXNG_SETTINGS_PATH="$__SEARXNG_CONFIG_PATH/settings.yml" \
|
|
GRANIAN_PROCESS_NAME="searxng" \
|
|
GRANIAN_INTERFACE="wsgi" \
|
|
GRANIAN_HOST="::" \
|
|
GRANIAN_PORT="8080" \
|
|
GRANIAN_WEBSOCKETS="false" \
|
|
GRANIAN_BLOCKING_THREADS="4" \
|
|
GRANIAN_WORKERS_KILL_TIMEOUT="30s" \
|
|
GRANIAN_BLOCKING_THREADS_IDLE_TIMEOUT="5m"
|
|
|
|
VOLUME $__SEARXNG_CONFIG_PATH
|
|
VOLUME $__SEARXNG_DATA_PATH
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/usr/local/searxng/entrypoint.sh"]
|