Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- Dockerfile +4 -11
- run.sh +50 -1
- settings.yml +2 -2
Dockerfile
CHANGED
|
@@ -2,29 +2,22 @@ FROM paulgoio/searxng:production
|
|
| 2 |
|
| 3 |
USER root
|
| 4 |
|
| 5 |
-
# Fix permissions for HF user 1000
|
| 6 |
RUN chown -R 1000:1000 /usr/local/searxng \
|
| 7 |
&& mkdir -p /etc/searxng /var/cache/searxng \
|
| 8 |
&& chown -R 1000:1000 /etc/searxng \
|
| 9 |
&& chown -R 1000:1000 /var/cache/searxng
|
| 10 |
|
| 11 |
-
# Install our thin wrapper deps
|
| 12 |
-
RUN pip install --no-cache-dir --break-system-packages fastapi uvicorn httpx
|
| 13 |
-
|
| 14 |
-
# Copy our files
|
| 15 |
-
COPY --chown=1000:1000 app.py /usr/local/searxng/app.py
|
| 16 |
-
COPY --chown=1000:1000 settings.yml /etc/searxng/settings.yml
|
| 17 |
COPY --chown=1000:1000 run.sh /usr/local/searxng/run.sh
|
| 18 |
RUN chmod +x /usr/local/searxng/run.sh
|
| 19 |
|
|
|
|
|
|
|
| 20 |
USER 1000
|
| 21 |
|
| 22 |
-
ENV GRANIAN_PORT=7860
|
| 23 |
-
ENV GRANIAN_HOST=0.0.0.0
|
| 24 |
ENV SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml
|
|
|
|
| 25 |
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
# Override: run our Python wrapper instead of granian
|
| 29 |
ENTRYPOINT ["/sbin/tini", "--"]
|
| 30 |
-
CMD ["
|
|
|
|
| 2 |
|
| 3 |
USER root
|
| 4 |
|
|
|
|
| 5 |
RUN chown -R 1000:1000 /usr/local/searxng \
|
| 6 |
&& mkdir -p /etc/searxng /var/cache/searxng \
|
| 7 |
&& chown -R 1000:1000 /etc/searxng \
|
| 8 |
&& chown -R 1000:1000 /var/cache/searxng
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
COPY --chown=1000:1000 run.sh /usr/local/searxng/run.sh
|
| 11 |
RUN chmod +x /usr/local/searxng/run.sh
|
| 12 |
|
| 13 |
+
COPY --chown=1000:1000 settings.yml /etc/searxng/settings.yml
|
| 14 |
+
|
| 15 |
USER 1000
|
| 16 |
|
|
|
|
|
|
|
| 17 |
ENV SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml
|
| 18 |
+
ENV BIND_ADDRESS=0.0.0.0:7860
|
| 19 |
|
| 20 |
EXPOSE 7860
|
| 21 |
|
|
|
|
| 22 |
ENTRYPOINT ["/sbin/tini", "--"]
|
| 23 |
+
CMD ["./run.sh"]
|
run.sh
CHANGED
|
@@ -1,2 +1,51 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
+
# v7 — Process-safe launcher
|
| 3 |
+
cd /usr/local/searxng
|
| 4 |
+
|
| 5 |
+
# Patch settings (same logic as your old run.sh but simplified)
|
| 6 |
+
python3 << 'PYEOF'
|
| 7 |
+
import secrets, os
|
| 8 |
+
|
| 9 |
+
f = os.environ.get("SEARXNG_SETTINGS_PATH", "/etc/searxng/settings.yml")
|
| 10 |
+
if not os.path.exists(f):
|
| 11 |
+
f = "searx/settings.yml"
|
| 12 |
+
|
| 13 |
+
lines = open(f).readlines()
|
| 14 |
+
output = []
|
| 15 |
+
json_added = False
|
| 16 |
+
|
| 17 |
+
for line in lines:
|
| 18 |
+
s = line.strip()
|
| 19 |
+
if "ultrasecretkey" in line:
|
| 20 |
+
line = line.replace("ultrasecretkey", secrets.token_hex(32))
|
| 21 |
+
if s.startswith("port:") and "8080" in s:
|
| 22 |
+
line = line.replace("8080", "7860")
|
| 23 |
+
if "bind_address" in s and "127.0.0.1" in s:
|
| 24 |
+
line = line.replace("127.0.0.1", "0.0.0.0")
|
| 25 |
+
if s.startswith("limiter:") and "true" in s:
|
| 26 |
+
line = line.replace("true", "false")
|
| 27 |
+
if s.startswith("image_proxy:") and "true" in s:
|
| 28 |
+
line = line.replace("true", "false")
|
| 29 |
+
if s == "- html" and not json_added:
|
| 30 |
+
output.append(line)
|
| 31 |
+
indent = line[:len(line) - len(line.lstrip())]
|
| 32 |
+
output.append(f"{indent}- json\n")
|
| 33 |
+
json_added = True
|
| 34 |
+
continue
|
| 35 |
+
output.append(line)
|
| 36 |
+
|
| 37 |
+
open(f, "w").writelines(output)
|
| 38 |
+
print(f"Settings patched, json_format={json_added}")
|
| 39 |
+
PYEOF
|
| 40 |
+
|
| 41 |
+
echo "Starting engine on port 7860..."
|
| 42 |
+
|
| 43 |
+
# Run via werkzeug — process name is "python3", not "searxng" or "granian"
|
| 44 |
+
exec python3 -c "
|
| 45 |
+
import os
|
| 46 |
+
os.environ['SEARXNG_SETTINGS_PATH'] = '/etc/searxng/settings.yml'
|
| 47 |
+
os.chdir('/usr/local/searxng')
|
| 48 |
+
from searx.webapp import app
|
| 49 |
+
from werkzeug.serving import run_simple
|
| 50 |
+
run_simple('0.0.0.0', 7860, app, threaded=True, use_reloader=False)
|
| 51 |
+
"
|
settings.yml
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
use_default_settings: true
|
| 2 |
|
| 3 |
server:
|
| 4 |
-
bind_address: "
|
| 5 |
-
secret_key: "
|
| 6 |
limiter: false
|
| 7 |
image_proxy: false
|
| 8 |
public_instance: false
|
|
|
|
| 1 |
use_default_settings: true
|
| 2 |
|
| 3 |
server:
|
| 4 |
+
bind_address: "0.0.0.0:7860"
|
| 5 |
+
secret_key: "meta_api_v7_key_2026"
|
| 6 |
limiter: false
|
| 7 |
image_proxy: false
|
| 8 |
public_instance: false
|