summaryrefslogtreecommitdiff
path: root/container
diff options
context:
space:
mode:
authorIvan Gabaldon <igabaldon@inetol.net>2026-03-28 16:45:06 +0100
committerGitHub <noreply@github.com>2026-03-28 16:45:06 +0100
commit6b9856d6438a546cbacbcb401334c8bdd33385b6 (patch)
treee9755ea28f809a9833a8ca34fc6643b25be65672 /container
parente58516daf5bd67e52b777c6bc97f4464bc6825c3 (diff)
[mod] container: rework compose (#5906)
* [mod] container: rework compose See https://docs.searxng.org/admin/installation-docker.html#migrate-from-searxng-docker * [mod] container: apply suggestions https://github.com/searxng/searxng/pull/5906#discussion_r3004917087 https://github.com/searxng/searxng/pull/5906#discussion_r3004917090 https://github.com/searxng/searxng/pull/5906#discussion_r3004917084
Diffstat (limited to 'container')
-rw-r--r--container/.env.example15
-rw-r--r--container/dist.dockerfile26
-rw-r--r--container/docker-compose.yml28
-rwxr-xr-xcontainer/entrypoint.sh16
4 files changed, 67 insertions, 18 deletions
diff --git a/container/.env.example b/container/.env.example
new file mode 100644
index 000000000..de2d1dd62
--- /dev/null
+++ b/container/.env.example
@@ -0,0 +1,15 @@
+# Read the documentation before using the `docker-compose.yml` file:
+# https://docs.searxng.org/admin/installation-docker.html
+#
+# Additional ENVs:
+# https://docs.searxng.org/admin/settings/settings_general.html#settings-general
+# https://docs.searxng.org/admin/settings/settings_server.html#settings-server
+
+# Use a specific version tag. E.g. "latest" or "2026.3.25-541c6c3cb".
+#SEARXNG_VERSION=latest
+
+# Listen to a specific address.
+#SEARXNG_HOST=[::]
+
+# Listen to a specific port.
+#SEARXNG_PORT=8080
diff --git a/container/dist.dockerfile b/container/dist.dockerfile
index f2d4b0fee..b8af66f35 100644
--- a/container/dist.dockerfile
+++ b/container/dist.dockerfile
@@ -15,17 +15,17 @@ 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"
-
-ENV SEARXNG_VERSION="$VERSION" \
- SEARXNG_SETTINGS_PATH="$CONFIG_PATH/settings.yml" \
+ 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"
+
+ENV __SEARXNG_VERSION="$VERSION" \
+ __SEARXNG_SETTINGS_PATH="$__SEARXNG_CONFIG_PATH/settings.yml" \
GRANIAN_PROCESS_NAME="searxng" \
GRANIAN_INTERFACE="wsgi" \
GRANIAN_HOST="::" \
@@ -36,8 +36,8 @@ ENV SEARXNG_VERSION="$VERSION" \
GRANIAN_BLOCKING_THREADS_IDLE_TIMEOUT="5m"
# "*_PATH" ENVs are defined in base images
-VOLUME $CONFIG_PATH
-VOLUME $DATA_PATH
+VOLUME $__SEARXNG_CONFIG_PATH
+VOLUME $__SEARXNG_DATA_PATH
EXPOSE 8080
diff --git a/container/docker-compose.yml b/container/docker-compose.yml
new file mode 100644
index 000000000..d2d53e869
--- /dev/null
+++ b/container/docker-compose.yml
@@ -0,0 +1,28 @@
+# Read the documentation before using the `docker-compose.yml` file:
+# https://docs.searxng.org/admin/installation-docker.html
+
+name: searxng
+
+services:
+ core:
+ container_name: searxng-core
+ image: docker.io/searxng/searxng:${SEARXNG_VERSION:-latest}
+ restart: always
+ ports:
+ - ${SEARXNG_HOST:+${SEARXNG_HOST}:}${SEARXNG_PORT:-8080}:${SEARXNG_PORT:-8080}
+ env_file: ./.env
+ volumes:
+ - ./core-config/:/etc/searxng/:Z
+ - core-data:/var/cache/searxng/
+
+ valkey:
+ container_name: searxng-valkey
+ image: docker.io/valkey/valkey:9-alpine
+ command: valkey-server --save 30 1 --loglevel warning
+ restart: always
+ volumes:
+ - valkey-data:/data/
+
+volumes:
+ core-data:
+ valkey-data:
diff --git a/container/entrypoint.sh b/container/entrypoint.sh
index 10844f115..d33748bed 100755
--- a/container/entrypoint.sh
+++ b/container/entrypoint.sh
@@ -117,16 +117,22 @@ EOF
}
cat <<EOF
-SearXNG $SEARXNG_VERSION
+SearXNG $__SEARXNG_VERSION
EOF
# Check for volume mounts
-volume_handler "$CONFIG_PATH"
-volume_handler "$DATA_PATH"
+volume_handler "$__SEARXNG_CONFIG_PATH"
+volume_handler "$__SEARXNG_DATA_PATH"
# Check for files
-config_handler "$SEARXNG_SETTINGS_PATH" "/usr/local/searxng/searx/settings.yml"
+config_handler "$__SEARXNG_SETTINGS_PATH" "/usr/local/searxng/searx/settings.yml"
-update-ca-certificates
+# root only features
+if [ "$(id -u)" -eq 0 ]; then
+ update-ca-certificates
+fi
+
+# ENVs aliases
+export GRANIAN_PORT="${SEARXNG_PORT:-$GRANIAN_PORT}"
exec /usr/local/searxng/.venv/bin/granian searx.webapp:app