5BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")"
12SEARX_DIR="$BASE_DIR/searx"
15. "${BASE_DIR}/utils/brand.env"
22 pip install --upgrade pip
23 pip install --upgrade setuptools
24 pip install -Ur "$BASE_DIR/requirements.txt"
27update_dev_packages() {
29 pip install -Ur "$BASE_DIR/requirements-dev.txt"
32install_geckodriver() {
33 echo '[!] Checking geckodriver'
34 # TODO : check the current geckodriver version
36 geckodriver -V > /dev/null 2>&1 || NOTFOUND=1
38 if [ -z "$NOTFOUND" ]; then
41 GECKODRIVER_VERSION="v0.28.0"
42 PLATFORM="`python3 -c "import platform; print(platform.system().lower(), platform.architecture()[0])"`"
44 "linux 32bit" | "linux2 32bit") ARCH="linux32";;
45 "linux 64bit" | "linux2 64bit") ARCH="linux64";;
46 "windows 32 bit") ARCH="win32";;
47 "windows 64 bit") ARCH="win64";;
48 "mac 64bit") ARCH="macos";;
50 GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";
53 if [ -z "$VIRTUAL_ENV" ]; then
54 printf "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n %s" "$GECKODRIVER_URL"
57 GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
61 mkdir -p -- "$GECKODRIVER_DIR"
64 printf "Installing %s/geckodriver from\n %s" "$GECKODRIVER_DIR" "$GECKODRIVER_URL"
67 wget -qO "$FILE" -- "$GECKODRIVER_URL" && tar xz -C "$GECKODRIVER_DIR" -f "$FILE" geckodriver
69 chmod 777 -- "$GECKODRIVER_DIR/geckodriver"
73 pybabel compile -d "$SEARX_DIR/translations"
82 which npm || (printf 'Error: npm is not found\n'; exit 1)
83 export PATH="$(npm bin)":$PATH
89 echo '[!] install NPM packages'
91 npm install less@2.7 less-plugin-clean-css grunt-cli
93 echo '[!] install NPM packages for oscar theme'
94 cd -- "$BASE_DIR/searx/static/themes/oscar"
97 echo '[!] install NPM packages for simple theme'
98 cd -- "$BASE_DIR/searx/static/themes/simple"
103 # Check if it is a git repository
104 if [ ! -d .git ]; then
105 echo "This is not Git repository"
109 if [ ! -x "$(which git)" ]; then
110 echo "git is not installed"
114 if [ ! git remote get-url origin 2> /dev/null ]; then
115 echo "there is no remote origin"
119 # This is a git repository
121 # "git describe" to get the Docker version (for example : v0.15.0-89-g0585788e)
122 # awk to remove the "v" and the "g"
123 SEARX_GIT_VERSION=$(git describe --match "v[0-9]*\.[0-9]*\.[0-9]*" HEAD 2>/dev/null | awk -F'-' '{OFS="-"; $1=substr($1, 2); if ($3) { $3=substr($3, 2); } print}')
125 # add the suffix "-dirty" if the repository has uncommited change
126 # /!\ HACK for searx/searx: ignore utils/brand.env
127 git update-index -q --refresh
128 if [ ! -z "$(git diff-index --name-only HEAD -- | grep -v 'utils/brand.env')" ]; then
129 SEARX_GIT_VERSION="${SEARX_GIT_VERSION}-dirty"
132 # Get the last git commit id, will be added to the Searx version (see Dockerfile)
133 VERSION_GITCOMMIT=$(echo $SEARX_GIT_VERSION | cut -d- -f2-4)
134 echo "Last commit : $VERSION_GITCOMMIT"
136 # Check consistency between the git tag and the searx/version.py file
137 # /!\ HACK : parse Python file with bash /!\
138 # otherwise it is not possible build the docker image without all Python dependencies ( version.py loads __init__.py )
139 # SEARX_PYTHON_VERSION=$(python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)")
140 SEARX_PYTHON_VERSION=$(cat searx/version.py | grep "\(VERSION_MAJOR\|VERSION_MINOR\|VERSION_BUILD\) =" | cut -d\= -f2 | sed -e 's/^[[:space:]]*//' | paste -sd "." -)
141 if [ $(echo "$SEARX_GIT_VERSION" | cut -d- -f1) != "$SEARX_PYTHON_VERSION" ]; then
142 echo "Inconsistency between the last git tag and the searx/version.py file"
143 echo "git tag: $SEARX_GIT_VERSION"
144 echo "searx/version.py: $SEARX_PYTHON_VERSION"
148 # define the docker image name
149 GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/')
150 SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx"
153 echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
155 --build-arg GIT_URL="${GIT_URL}" \
156 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
157 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
158 --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
159 --build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
160 --build-arg LABEL_VCS_URL="${GIT_URL}" \
161 --build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \
162 --build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \
163 -t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} .
165 if [ "$1" = "push" ]; then
166 sudo docker push ${SEARX_IMAGE_NAME}:latest
167 sudo docker push ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}
176 [ -z "$1" ] || printf 'Error: %s\n' "$1"
177 echo "Searx manage.sh help
185 update_packages - Check & update production dependency changes
186 update_dev_packages - Check & update development and production dependency changes
187 install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests)
188 npm_packages - Download & install npm dependencies
192 locales - Compile locales
196 ISSUE_URL: ${ISSUE_URL}
197 SEARX_URL: ${SEARX_URL}
198 DOCS_URL: ${DOCS_URL}
199 PUBLIC_INSTANCES: ${PUBLIC_INSTANCES}
203[ "$(command -V "$ACTION" | grep ' function$')" = "" ] \
204 && help "action not found" \
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list