Initial version

This commit is contained in:
Knut Ahlers 2019-07-14 14:23:07 +02:00
commit 226932a929
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 75 additions and 0 deletions

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM python:3-alpine
ENV INSTALL_DIR=/opt/searx \
VERSION=v0.15.0
COPY build.sh /usr/local/bin
RUN set -ex \
&& apk --no-cache add \
bash \
&& bash /usr/local/bin/build.sh
COPY run.sh /usr/local/bin
WORKDIR /opt/searx
EXPOSE 8888
ENTRYPOINT ["bash"]
CMD ["/usr/local/bin/run.sh"]

39
build.sh Normal file
View file

@ -0,0 +1,39 @@
#!/bin/bash
set -euxo pipefail
build_packages=(
curl
git
build-base
libffi-dev
libxml2-dev
libxslt-dev
openssl-dev
)
dep_packages=(
libffi
libxml2
libxslt
openssl
)
apk --no-cache add "${build_packages[@]}" "${dep_packages[@]}"
curl -sSfLo /usr/local/bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64"
chmod +x /usr/local/bin/dumb-init
mkdir -p "$(dirname "${INSTALL_DIR}")"
git clone "https://github.com/asciimoo/searx.git" "${INSTALL_DIR}"
pushd "${INSTALL_DIR}"
git reset --hard "${VERSION}"
git clean -fdx
sh manage.sh update_packages
sed -i 's/bind_address : "127.0.0.1"/bind_address : "0.0.0.0"/' searx/settings.yml
popd
apk --no-cache del "${build_packages[@]}"

17
run.sh Normal file
View file

@ -0,0 +1,17 @@
#!/usr/local/bin/dumb-init /bin/bash
set -euo pipefail
SECRET_KEY=${SECRET_KEY:-}
[[ -n ${SECRET_KEY} ]] || {
SECRET_KEY=$(openssl rand -hex 32)
echo "Attention: Secret key was auto-generated! You should"
echo "set it via SECRET_KEY env var to keep it persistent"
}
[[ -z ${BASE_URL:-} ]] || {
sed -i "s@base_url : False@base_url : '${BASE_URL}'@" searx/settings.yml
}
sed -i "s/secret_key : \"ultrasecretkey\"/secret_key : '${SECRET_KEY}'/" searx/settings.yml
exec python searx/webapp.py