| # Use the official SearXNG image as a base | |
| FROM searxng/searxng:latest | |
| # HF Spaces runs containers as user 1000 | |
| # The searxng image already uses a non-root user, but we need to | |
| # adjust ownership and port to match HF requirements. | |
| USER root | |
| # Copy our custom settings into the image | |
| COPY searxng/settings.yml /etc/searxng/settings.yml | |
| # Give the searxng user ownership of the config | |
| RUN chown -R searxng:searxng /etc/searxng | |
| USER searxng | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| # Override the default port via environment variable | |
| ENV SEARXNG_PORT=7860 | |
| # Pass the secret key in at runtime via HF Space secret | |
| # Set SEARXNG_SECRET in your Space settings → Variables & Secrets | |
| CMD ["python", "-m", "searx.webapp"] | |