fix: restore working Dockerfile (SearXNG pip install + msgspec + --no-build-isolation)

This commit is contained in:
JianFeeeee
2026-09-09 10:22:10 +08:00
parent 0fe13fc90b
commit 5d4cd64b30

View File

@ -12,13 +12,14 @@ COPY admin-server/ .
RUN GOPROXY=https://goproxy.cn,direct go mod tidy && CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/admin-server .
# ── Stage 2: SearXNG from source ──
# Build args for proxy (passed at build time)
ARG HTTP_PROXY=""
ARG HTTPS_PROXY=""
FROM debian:bookworm-slim AS searxng-build
ARG HTTP_PROXY=http://172.17.0.1:7890
ARG HTTPS_PROXY=http://172.17.0.1:7890
ENV DEBIAN_FRONTEND=noninteractive
ENV http_proxy=${HTTP_PROXY}
ENV https_proxy=${HTTPS_PROXY}
ENV HTTP_PROXY=${HTTP_PROXY}
ENV HTTPS_PROXY=${HTTPS_PROXY}
@ -26,16 +27,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip python3-venv git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install SearXNG dependencies with proxy support
# Using --retries and longer timeout for reliability
RUN python3 -m venv /opt/searxng-venv && \
/opt/searxng-venv/bin/pip install --upgrade pip setuptools wheel && \
/opt/searxng-venv/bin/pip install --retries 5 --timeout 120 \
msgspec beautifulsoup4 lxml html5lib flask werkzeug gunicorn \
pyyaml python-dateutil flask-babel psutil pygments pymdown-extensions \
redis brotli brotli-ffi websocket-client httpx/setuptools && \
/opt/searxng-venv/bin/pip install --no-build-isolation \
"git+https://github.com/searxng/searxng.git@master"
RUN git clone --depth 1 https://github.com/searxng/searxng.git /src/searxng \
&& python3 -m venv /opt/searxng-venv \
&& /opt/searxng-venv/bin/pip install --upgrade pip setuptools wheel msgspec \
&& cd /src/searxng \
&& /opt/searxng-venv/bin/pip install --no-cache-dir -r requirements.txt \
&& /opt/searxng-venv/bin/pip install --no-cache-dir --no-build-isolation . \
&& rm -rf /src/searxng
# ── Stage 3: Runtime ──
FROM debian:bookworm-slim