导航页现在会自动检测浏览历史插件是否已安装: - 扩展在用户配置的服务地址上动态注册 content script (Chrome: chrome.scripting.registerContentScripts, Firefox: browser.contentScripts.register), 于 document_start 给 <html> 打上 data-navi-ext 标记, 不在其他站点运行。 - history-server 始终把「安装浏览历史插件」放在「历史访问」第一条 (入口 url=/extension/install.html),启动时也会重建一次, 不再需要等下一次同步。 - web/navi.js 读到标记后隐藏该入口(连 .item-wrapper 一起隐藏, 避免留下空网格位)。 - 新增 /extension/install.html:自动识别浏览器,给出对应安装包与步骤; 支持在 data 卷放 extension-store.json 配置商店链接, 有商店链接时显示真正的「一键安装」。 - 段落名匹配同时兼容中英文(常用服务/Favorites、历史访问/History), 修掉了公开示例 conf.yml 用英文名时重建逻辑完全失效的问题。 - 扩展升到 1.1.0(新增 scripting 权限与 detect.js)。 Note: Chrome/Edge 不允许从网站直接安装非商店扩展, 因此自托管场景下只能下载后手动加载;发布到商店后才会出现一键安装。
96 lines
3.6 KiB
Docker
96 lines
3.6 KiB
Docker
# syntax=docker/dockerfile:1
|
||
|
||
# ── Stage 1: Go binaries ──
|
||
FROM golang:1.21-bookworm AS gobuild
|
||
|
||
WORKDIR /src/history
|
||
COPY history-server/ .
|
||
RUN GOPROXY=https://goproxy.cn,direct CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/history-server .
|
||
|
||
WORKDIR /src/admin
|
||
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 ──
|
||
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}
|
||
|
||
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/*
|
||
|
||
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: browser extension packages ──
|
||
# 供 /extension/install.html 下载(Chromium 用 zip,Firefox 用 xpi)
|
||
FROM debian:bookworm-slim AS extpack
|
||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends zip ca-certificates \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
COPY extension/chrome /src/chrome
|
||
COPY extension/firefox /src/firefox
|
||
RUN cd /src/chrome && zip -qr /out/navi-chrome.zip . \
|
||
&& cd /src/firefox && zip -qr /out/navi-firefox.xpi .
|
||
|
||
# ── Stage 4: Runtime ──
|
||
FROM debian:bookworm-slim
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive
|
||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
nginx python3 supervisor curl ca-certificates git \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# Copy SearXNG venv + source
|
||
COPY --from=searxng-build /opt/searxng-venv /app/searxng-venv
|
||
COPY --from=searxng-build /usr/lib/python3.11 /usr/lib/python3.11
|
||
COPY --from=searxng-build /lib/x86_64-linux-gnu /lib/x86_64-linux-gnu
|
||
COPY --from=searxng-build /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
|
||
|
||
# Dashy static files
|
||
COPY --from=lissy93/dashy:latest /app/dist /app/dashy
|
||
|
||
# Go binaries
|
||
COPY --from=gobuild /out/history-server /usr/local/bin/history-server
|
||
COPY --from=gobuild /out/admin-server /usr/local/bin/admin-server
|
||
|
||
# Config files
|
||
COPY nginx.conf /etc/nginx/nginx.conf
|
||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||
COPY searxng-settings.yml /etc/searxng/settings.yml
|
||
COPY conf.example.yml /app/defaults/conf.yml
|
||
COPY admin/index.html /app/admin/index.html
|
||
|
||
# 浏览器扩展安装页与安装包(通过 /extension/ 访问)
|
||
COPY web/extension/install.html /app/dashy/extension/install.html
|
||
COPY --from=extpack /out/navi-chrome.zip /app/dashy/extension/navi-chrome.zip
|
||
COPY --from=extpack /out/navi-firefox.xpi /app/dashy/extension/navi-firefox.xpi
|
||
|
||
# Inject search script into Dashy
|
||
COPY web/navi.js /app/dashy/navi.js
|
||
RUN sed -i 's#</body>#<script src="/navi.js"></script></body>#' /app/dashy/index.html
|
||
|
||
# Data directory
|
||
RUN mkdir -p /app/data/item-icons /var/log/supervisor /var/cache/searxng /run/nginx
|
||
|
||
VOLUME ["/app/data"]
|
||
EXPOSE 8080
|
||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||
CMD curl -fs http://localhost:8080/conf.yml || exit 1
|
||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|