站点首页此前显示的是 Dashy 上游的 logo —— index.html 里那几条
<link rel=icon href=/web-icons/favicon-*.png> 优先级高于我们的门户图标,
而扩展的 PNG 是占位图(128px 只有 9 种颜色、alpha 通道还是乱的)。
- portal/favicon.svg:纸飞机(圆角渐变底 + 白色折纸机头朝右上 + 两道尾迹),
几何收在 8..56 安全区,避免贴边被圆角裁切
- 由该 SVG 派生 favicon.ico(16/32/48)、apple-touch-icon(180)、
web-icons/favicon-{16,32,64}、扩展 icon{16,48,96,128}
- patch-index.py:删掉上游 icon link 并显式指向 /favicon.svg(幂等,
重复执行 unchanged);上游 web-icons 那批也覆盖一份作双保险
- Dockerfile 与 zd-host.sh 都 COPY 这些图标进镜像
- 验证:nginx 沙箱实测 /favicon.svg、/web-icons/*、/apple-touch-icon.png 均 200;
16px 下人眼仍可辨识为纸飞机
- .amo-upload-uuid(web-ext 生成的 UUID)改为忽略
114 lines
4.7 KiB
Docker
114 lines
4.7 KiB
Docker
# 不用 `# syntax=docker/dockerfile:1`:该指令会让 BuildKit 去 pull
|
||
# docker/dockerfile 前端镜像,在无外网/仅代理的环境里会直接构建失败。
|
||
# 本文件未使用任何 BuildKit 专有语法,去掉后走内置前端即可。
|
||
|
||
# ── 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
|
||
|
||
# 需要代理时用 --build-arg 传入(默认不设,保证他人环境可直接构建)
|
||
ARG HTTP_PROXY=
|
||
ARG HTTPS_PROXY=
|
||
|
||
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 -o Acquire::Retries=5 -o Acquire::http::Timeout=30 update \
|
||
&& apt-get -o Acquire::Retries=5 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 -o Acquire::Retries=5 -o Acquire::http::Timeout=30 update \
|
||
&& apt-get -o Acquire::Retries=5 install -y --no-install-recommends zip ca-certificates \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
COPY extension/chrome /src/chrome
|
||
COPY extension/firefox /src/firefox
|
||
# Go 的 -o 会自动建父目录,zip 不会,所以这里必须显式创建 /out
|
||
RUN mkdir -p /out \
|
||
&& 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 -o Acquire::Retries=5 -o Acquire::http::Timeout=30 update \
|
||
&& apt-get -o Acquire::Retries=5 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
|
||
COPY portal /app/portal
|
||
# 站点图标:纸飞机。覆盖 Dashy 自带的 web-icons/favicon-*.png,
|
||
# 这样即使将来上游 index.html 变了、patch 失效,标签栏仍是我们的图标。
|
||
COPY portal/favicon.svg /app/dashy/favicon.svg
|
||
COPY portal/favicon.ico /app/dashy/favicon.ico
|
||
COPY portal/apple-touch-icon.png /app/dashy/apple-touch-icon.png
|
||
COPY portal/web-icons/ /app/dashy/web-icons/
|
||
|
||
# 浏览器扩展安装页与安装包(通过 /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
|
||
COPY web/navi.css /app/dashy/navi.css
|
||
COPY web/patch-index.py /tmp/patch-index.py
|
||
# index.html 里不一定有 </body>,用脚本幂等注入,不能靠 sed 替换 </body>。
|
||
RUN python3 /tmp/patch-index.py /app/dashy/index.html
|
||
|
||
# Data directory
|
||
RUN mkdir -p /app/data/item-icons /app/data/gateway /var/log/supervisor /var/cache/searxng /run/nginx
|
||
|
||
VOLUME ["/app/data"]
|
||
EXPOSE 18080 3080 3081 8443
|
||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||
CMD curl -fs http://localhost:18080/healthz || exit 1
|
||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|