1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-05 04:40:11 +01:00

[fix] docker-entrypoint.sh -h hangs if searx is a valid user (#2099)

Implement a more robust detection if a process runs inside or outside of a
docker image.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-08-18 17:14:06 +00:00 committed by GitHub
parent a5e6423c39
commit 9b9b5e9625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,21 +15,21 @@ help() {
printf " BIND_ADDRESS uwsgi bind to the specified TCP socket using HTTP protocol. Default value: \"${DEFAULT_BIND_ADDRESS}\"\n" printf " BIND_ADDRESS uwsgi bind to the specified TCP socket using HTTP protocol. Default value: \"${DEFAULT_BIND_ADDRESS}\"\n"
printf "\nVolume:\n\n" printf "\nVolume:\n\n"
printf " /etc/searx the docker entry point copies settings.yml and uwsgi.ini in this directory (see the -f command line option)\n" printf " /etc/searx the docker entry point copies settings.yml and uwsgi.ini in this directory (see the -f command line option)\n"
echo
exit 0 exit 0
} }
if ! grep docker /proc/1/cgroup -qa; then
help
fi
export DEFAULT_BIND_ADDRESS="0.0.0.0:8080" export DEFAULT_BIND_ADDRESS="0.0.0.0:8080"
if [ -z "${BIND_ADDRESS}" ]; then if [ -z "${BIND_ADDRESS}" ]; then
export BIND_ADDRESS="${DEFAULT_BIND_ADDRESS}" export BIND_ADDRESS="${DEFAULT_BIND_ADDRESS}"
fi fi
export SEARX_VERSION=$(su searx -c 'python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)"' 2>/dev/null) export SEARX_VERSION=$(su searx -c 'python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)"' 2>/dev/null)
if [ -z "${SEARX_VERSION}" ]; then printf 'searx version %s\n\n' "${SEARX_VERSION}"
# outside docker, display help
help
else
printf 'searx version %s\n\n' "${SEARX_VERSION}"
fi
export UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini export UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
export SEARX_SETTINGS_PATH=/etc/searx/settings.yml export SEARX_SETTINGS_PATH=/etc/searx/settings.yml