Spaces:
Running
Running
Commit ·
d688beb
1
Parent(s): 1f652e8
ok
Browse files- Dockerfile +12 -0
- searxng/settings.yml +194 -0
- start.sh +41 -1
Dockerfile
CHANGED
|
@@ -5,10 +5,17 @@ LABEL description="All API Collection - Document extraction, conversion, and dat
|
|
| 5 |
LABEL version="1.0.0"
|
| 6 |
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 8 |
curl \
|
| 9 |
ffmpeg \
|
|
|
|
| 10 |
libmagic1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
nodejs \
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
RUN groupadd --gid 1000 appuser && \
|
|
@@ -21,6 +28,11 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
| 21 |
pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu && \
|
| 22 |
python -m spacy download en_core_web_sm
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
COPY --chown=appuser:appuser . .
|
| 25 |
|
| 26 |
RUN mkdir -p /app/models && python3 -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='ibm-granite/granite-embedding-small-english-r2', local_dir='/app/models/bge-384')" && chown -R appuser:appuser /app/models
|
|
|
|
| 5 |
LABEL version="1.0.0"
|
| 6 |
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
build-essential \
|
| 9 |
curl \
|
| 10 |
ffmpeg \
|
| 11 |
+
git \
|
| 12 |
libmagic1 \
|
| 13 |
+
libxml2-dev \
|
| 14 |
+
libxslt-dev \
|
| 15 |
+
libffi-dev \
|
| 16 |
+
libssl-dev \
|
| 17 |
nodejs \
|
| 18 |
+
zlib1g-dev \
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
RUN groupadd --gid 1000 appuser && \
|
|
|
|
| 28 |
pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu && \
|
| 29 |
python -m spacy download en_core_web_sm
|
| 30 |
|
| 31 |
+
RUN git clone --depth 1 --branch v2025.4.28 https://github.com/searxng/searxng.git /tmp/searxng && \
|
| 32 |
+
cd /tmp/searxng && \
|
| 33 |
+
pip install --no-cache-dir --use-pep517 --no-build-isolation -e . && \
|
| 34 |
+
rm -rf /tmp/searxng/.git
|
| 35 |
+
|
| 36 |
COPY --chown=appuser:appuser . .
|
| 37 |
|
| 38 |
RUN mkdir -p /app/models && python3 -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='ibm-granite/granite-embedding-small-english-r2', local_dir='/app/models/bge-384')" && chown -R appuser:appuser /app/models
|
searxng/settings.yml
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
use_default_settings: true
|
| 2 |
+
|
| 3 |
+
general:
|
| 4 |
+
instance_name: "My SearXNG"
|
| 5 |
+
debug: false
|
| 6 |
+
enable_metrics: false
|
| 7 |
+
|
| 8 |
+
search:
|
| 9 |
+
safe_search: 0
|
| 10 |
+
autocomplete: google
|
| 11 |
+
formats:
|
| 12 |
+
- html
|
| 13 |
+
- json
|
| 14 |
+
- csv
|
| 15 |
+
- rss
|
| 16 |
+
|
| 17 |
+
server:
|
| 18 |
+
secret_key: "3f7a8b2c9d1e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
|
| 19 |
+
bind_address: "0.0.0.0"
|
| 20 |
+
port: 8888
|
| 21 |
+
limiter: false
|
| 22 |
+
image_proxy: true
|
| 23 |
+
method: GET
|
| 24 |
+
default_http_headers:
|
| 25 |
+
X-Content-Type-Options: nosniff
|
| 26 |
+
X-Download-Options: noopen
|
| 27 |
+
X-Robots-Tag: noindex, nofollow
|
| 28 |
+
Referrer-Policy: no-referrer
|
| 29 |
+
Access-Control-Allow-Origin: "*"
|
| 30 |
+
Access-Control-Allow-Methods: "GET, POST, OPTIONS"
|
| 31 |
+
Access-Control-Allow-Headers: "Content-Type"
|
| 32 |
+
|
| 33 |
+
ui:
|
| 34 |
+
static_path: ""
|
| 35 |
+
templates_path: ""
|
| 36 |
+
default_theme: simple
|
| 37 |
+
default_locale: ""
|
| 38 |
+
theme_args:
|
| 39 |
+
simple_style: auto
|
| 40 |
+
search_on_category_select: true
|
| 41 |
+
hotkeys: default
|
| 42 |
+
|
| 43 |
+
outgoing:
|
| 44 |
+
request_timeout: 10.0
|
| 45 |
+
max_request_timeout: 15.0
|
| 46 |
+
useragent_suffix: ""
|
| 47 |
+
pool_connections: 200
|
| 48 |
+
pool_maxsize: 50
|
| 49 |
+
enable_http2: true
|
| 50 |
+
|
| 51 |
+
categories_as_tabs:
|
| 52 |
+
general:
|
| 53 |
+
images:
|
| 54 |
+
videos:
|
| 55 |
+
news:
|
| 56 |
+
map:
|
| 57 |
+
music:
|
| 58 |
+
it:
|
| 59 |
+
science:
|
| 60 |
+
files:
|
| 61 |
+
social media:
|
| 62 |
+
|
| 63 |
+
engines:
|
| 64 |
+
- name: duckduckgo
|
| 65 |
+
engine: duckduckgo
|
| 66 |
+
shortcut: ddg
|
| 67 |
+
weight: 3
|
| 68 |
+
|
| 69 |
+
- name: duckduckgo images
|
| 70 |
+
engine: duckduckgo_extra
|
| 71 |
+
categories: [images]
|
| 72 |
+
ddg_category: images
|
| 73 |
+
shortcut: ddi
|
| 74 |
+
weight: 3
|
| 75 |
+
|
| 76 |
+
- name: duckduckgo videos
|
| 77 |
+
engine: duckduckgo_extra
|
| 78 |
+
categories: [videos]
|
| 79 |
+
ddg_category: videos
|
| 80 |
+
shortcut: ddv
|
| 81 |
+
weight: 3
|
| 82 |
+
|
| 83 |
+
- name: duckduckgo news
|
| 84 |
+
engine: duckduckgo_extra
|
| 85 |
+
categories: [news]
|
| 86 |
+
ddg_category: news
|
| 87 |
+
shortcut: ddn
|
| 88 |
+
weight: 3
|
| 89 |
+
|
| 90 |
+
- name: wikipedia
|
| 91 |
+
engine: wikipedia
|
| 92 |
+
shortcut: wp
|
| 93 |
+
display_type: ["infobox"]
|
| 94 |
+
categories: [general]
|
| 95 |
+
|
| 96 |
+
- name: wikidata
|
| 97 |
+
engine: wikidata
|
| 98 |
+
shortcut: wd
|
| 99 |
+
timeout: 3.0
|
| 100 |
+
display_type: ["infobox"]
|
| 101 |
+
categories: [general]
|
| 102 |
+
|
| 103 |
+
- name: google
|
| 104 |
+
engine: google
|
| 105 |
+
shortcut: go
|
| 106 |
+
weight: 2
|
| 107 |
+
|
| 108 |
+
- name: google images
|
| 109 |
+
engine: google_images
|
| 110 |
+
shortcut: goi
|
| 111 |
+
weight: 2
|
| 112 |
+
|
| 113 |
+
- name: google news
|
| 114 |
+
engine: google_news
|
| 115 |
+
shortcut: gon
|
| 116 |
+
weight: 2
|
| 117 |
+
|
| 118 |
+
- name: google videos
|
| 119 |
+
engine: google_videos
|
| 120 |
+
shortcut: gov
|
| 121 |
+
weight: 2
|
| 122 |
+
|
| 123 |
+
- name: bing
|
| 124 |
+
engine: bing
|
| 125 |
+
shortcut: bi
|
| 126 |
+
disabled: true
|
| 127 |
+
|
| 128 |
+
- name: bing images
|
| 129 |
+
engine: bing_images
|
| 130 |
+
shortcut: bii
|
| 131 |
+
|
| 132 |
+
- name: bing news
|
| 133 |
+
engine: bing_news
|
| 134 |
+
shortcut: bin
|
| 135 |
+
|
| 136 |
+
- name: bing videos
|
| 137 |
+
engine: bing_videos
|
| 138 |
+
shortcut: biv
|
| 139 |
+
|
| 140 |
+
- name: github
|
| 141 |
+
engine: github
|
| 142 |
+
shortcut: gh
|
| 143 |
+
|
| 144 |
+
- name: docker hub
|
| 145 |
+
engine: docker_hub
|
| 146 |
+
shortcut: dh
|
| 147 |
+
categories: [it, packages]
|
| 148 |
+
|
| 149 |
+
- name: arxiv
|
| 150 |
+
engine: arxiv
|
| 151 |
+
shortcut: arx
|
| 152 |
+
categories: science
|
| 153 |
+
|
| 154 |
+
- name: openstreetmap
|
| 155 |
+
engine: openstreetmap
|
| 156 |
+
shortcut: osm
|
| 157 |
+
categories: map
|
| 158 |
+
|
| 159 |
+
- name: pixabay images
|
| 160 |
+
engine: pixabay
|
| 161 |
+
pixabay_type: images
|
| 162 |
+
categories: images
|
| 163 |
+
shortcut: pixi
|
| 164 |
+
|
| 165 |
+
- name: deviantart
|
| 166 |
+
engine: deviantart
|
| 167 |
+
shortcut: da
|
| 168 |
+
categories: images
|
| 169 |
+
timeout: 3.0
|
| 170 |
+
|
| 171 |
+
- name: flickr
|
| 172 |
+
categories: images
|
| 173 |
+
shortcut: fl
|
| 174 |
+
engine: flickr_noapi
|
| 175 |
+
|
| 176 |
+
- name: pexels
|
| 177 |
+
engine: pexels
|
| 178 |
+
shortcut: pe
|
| 179 |
+
categories: images
|
| 180 |
+
|
| 181 |
+
- name: bandcamp
|
| 182 |
+
engine: bandcamp
|
| 183 |
+
shortcut: bc
|
| 184 |
+
categories: music
|
| 185 |
+
|
| 186 |
+
- name: genius
|
| 187 |
+
engine: genius
|
| 188 |
+
shortcut: gen
|
| 189 |
+
categories: music
|
| 190 |
+
|
| 191 |
+
- name: mixcloud
|
| 192 |
+
engine: mixcloud
|
| 193 |
+
shortcut: mc
|
| 194 |
+
categories: music
|
start.sh
CHANGED
|
@@ -1,13 +1,53 @@
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
set -euo pipefail
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
HOST="${HOST:-0.0.0.0}"
|
| 7 |
PORT="${PORT:-7860}"
|
| 8 |
WORKERS="${WORKERS:-1}"
|
| 9 |
LOG_LEVEL="${LOG_LEVEL:-info}"
|
| 10 |
|
|
|
|
| 11 |
exec python -m uvicorn app.api.server:app \
|
| 12 |
--host "$HOST" \
|
| 13 |
--port "$PORT" \
|
|
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
set -euo pipefail
|
| 3 |
|
| 4 |
+
log() {
|
| 5 |
+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"
|
| 6 |
+
}
|
| 7 |
|
| 8 |
+
log "=== Starting up ==="
|
| 9 |
+
log "Python: $(python --version 2>&1)"
|
| 10 |
+
log "Working dir: $(pwd)"
|
| 11 |
+
|
| 12 |
+
# Check core deps
|
| 13 |
+
python -c "import markitdown, fastapi, httpx, pandas" 2>/dev/null
|
| 14 |
+
if [ $? -ne 0 ]; then
|
| 15 |
+
log "ERROR: Missing core dependencies"
|
| 16 |
+
python -c "import markitdown" 2>&1 | log
|
| 17 |
+
python -c "import fastapi" 2>&1 | log
|
| 18 |
+
python -c "import httpx" 2>&1 | log
|
| 19 |
+
python -c "import pandas" 2>&1 | log
|
| 20 |
+
exit 1
|
| 21 |
+
fi
|
| 22 |
+
log "Core dependencies: OK"
|
| 23 |
+
|
| 24 |
+
# Start SearXNG
|
| 25 |
+
export SEARXNG_SETTINGS_PATH="${SEARXNG_SETTINGS_PATH:-/app/searxng/settings.yml}"
|
| 26 |
+
log "SearXNG settings path: $SEARXNG_SETTINGS_PATH"
|
| 27 |
+
|
| 28 |
+
if [ -f "$SEARXNG_SETTINGS_PATH" ]; then
|
| 29 |
+
log "Starting SearXNG..."
|
| 30 |
+
searxng-run > /tmp/searxng.log 2>&1 &
|
| 31 |
+
SEARXNG_PID=$!
|
| 32 |
+
log "SearXNG PID: $SEARXNG_PID"
|
| 33 |
+
sleep 3
|
| 34 |
+
if kill -0 "$SEARXNG_PID" 2>/dev/null; then
|
| 35 |
+
log "SearXNG is running (PID: $SEARXNG_PID)"
|
| 36 |
+
else
|
| 37 |
+
log "WARNING: SearXNG process exited. Check /tmp/searxng.log"
|
| 38 |
+
cat /tmp/searxng.log 2>/dev/null | tail -10 | while IFS= read -r line; do log " searxng: $line"; done
|
| 39 |
+
fi
|
| 40 |
+
else
|
| 41 |
+
log "WARNING: SearXNG settings not found at $SEARXNG_SETTINGS_PATH, skipping SearXNG start"
|
| 42 |
+
fi
|
| 43 |
+
|
| 44 |
+
# Start main app
|
| 45 |
HOST="${HOST:-0.0.0.0}"
|
| 46 |
PORT="${PORT:-7860}"
|
| 47 |
WORKERS="${WORKERS:-1}"
|
| 48 |
LOG_LEVEL="${LOG_LEVEL:-info}"
|
| 49 |
|
| 50 |
+
log "Starting uvicorn: host=$HOST port=$PORT workers=$WORKERS log_level=$LOG_LEVEL"
|
| 51 |
exec python -m uvicorn app.api.server:app \
|
| 52 |
--host "$HOST" \
|
| 53 |
--port "$PORT" \
|