File size: 1,239 Bytes
5d9b66c 8cff1e7 5d9b66c 07f78ec 9aaee71 5d9b66c 452301f 1c9a40e 2a910c0 c45de05 8526da5 452301f 07f78ec 3dbacb4 07f78ec 8526da5 0f5f2cd 347022f 3dbacb4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# Use a lightweight Python image
FROM python:3.10-slim
# Install dependencies
RUN apt-get update && apt-get install -y git sqlite3 && rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m searxng
USER searxng
WORKDIR /home/searxng
# Clone SearXNG repository
RUN git clone --depth=1 https://github.com/searxng/searxng.git
# Install SearXNG dependencies
WORKDIR /home/searxng/searxng
RUN pip install --no-cache-dir -r requirements.txt
# Ensure the settings and config directories exist
RUN mkdir -p /home/searxng/searxng/searx /home/searxng/searxng/config
# Generate a secure secret key and save it to settings.yml
RUN python3 -c 'import secrets, os; os.makedirs("/home/searxng/searxng/searx", exist_ok=True); open("/home/searxng/searxng/searx/settings.yml", "w").write(f"server:\n secret_key: \"{secrets.token_hex(32)}\"\n")'
# Fix: Create an empty limiter.toml inside /home/searxng/searxng/config
RUN touch /home/searxng/searxng/config/limiter.toml
# Fix: Set environment variables
ENV PYTHONWARNINGS=ignore SQLITE_BUSY_TIMEOUT=5000 SEARXNG_SETTINGS_PATH=/home/searxng/searxng/config/
# Expose port 7860 (required for Hugging Face)
EXPOSE 7860
# Start SearXNG
CMD ["python", "-m", "searx.webapp", "--port", "7860"] |