如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
!https://github.com/user-attachments/assets/71b568f4-df46-4925-aa6c-1d2540a7c491
https://github.com/vemetric/favicon-api/actions/workflows/ci.yml/badge.svg](https://github.com/vemetric/favicon-api/actions/workflows/ci.yml) !https://img.shields.io/docker/v/vemetric/favicon-api
A free & self-hostable favicon API service built with TypeScript, Hono, and Bun. Fetch and serve website favicons with multiple format options, intelligent fallbacks, and proper HTTP caching.
Powered by Vemetric
bash# Install dependencies bun install # Start development server (with hot reload) bun run dev # The server will start on http://localhost:3000
Option 1: Use Pre-built Image from Docker Hub
bash# Run with default settings docker run -d \ -p 3000:3000 \ --name favicon-api \ --restart unless-stopped \ vemetric/favicon-api # Or run with custom configuration docker run -d \ -p 3000:3000 \ --name favicon-api \ --restart unless-stopped \ -e PORT=3000 \ -e DEFAULT_IMAGE_URL=https://example.com/default-favicon.png \ -e USE_FALLBACK_API=true \ -e CACHE_CONTROL_SUCCESS=604800 \ -e CACHE_CONTROL_FALLBACK=604800 \ -e CACHE_CONTROL_ERROR=604800 \ -e REQUEST_TIMEOUT=5000 \ -e MAX_IMAGE_SIZE=5242880 \ -e ALLOWED_ORIGINS=* \ -e BLOCK_PRIVATE_IPS=true \ vemetric/favicon-api # Check it's running curl http://localhost:3000/health
Option 2: Build from Source
bash# Build the image docker build -t favicon-api . # Run the locally built image docker run -d \ -p 3000:3000 \ --name favicon-api \ --restart unless-stopped \ favicon-api
GET /<domain>&response=<json|image>&size=<number>&format=<png|jpg|webp>&default=<url>
size (optional): Desired image size in pixels (16-512)format (optional): Image Output format - png, jpg, webpresponse (optional): Response format - image (default) or jsondefault (optional): Fallback image URL (overrides server config)Get favicon as image:
bashcurl "http://localhost:3000/github.com"
Get favicon metadata as JSON:
bashcurl "http://localhost:3000/github.com&response=json"
Resize favicon to 64x64:
bashcurl "http://localhost:3000/github.com&size=64"
Convert to PNG:
bashcurl "http://localhost:3000/github.com&format=png&size=128"
With custom fallback:
bashcurl "http://localhost:3000/example.com&default=https://mysite.com/fallback.png"
Create a .env file (see .env.example):
DEFAULT_IMAGE_URL unset: use the bundled default.svg fallback imageDEFAULT_IMAGE_URL=https://example.com/default-favicon.png: use a custom fallback imageDEFAULT_IMAGE_URL=none: disable the default fallback image and return 404 when no favicon is foundCACHE_CONTROL_FALLBACK: cache time for fallback responses after favicon lookup fails, including default images and disabled-fallback 404 responsesThe application is a stateless processor with no built-in caching. It:
For production, add a caching layer in front (CDN or reverse proxy):
bash# Install dependencies bun install # Run development server (with hot reload) bun run dev # Run tests bun test # Run tests in watch mode bun test --watch # Type check bun run typecheck # Lint bun run lint # Format code bun run format
Using Pre-built Image:
bash# Pull and run from Docker Hub docker run -d \ -p 3000:3000 \ --name favicon-api \ --restart unless-stopped \ vemetric/favicon-api # Verify it's running curl http://your-server-ip:3000/health
Building from Source:
bashgit clone https://github.com/vemetric/favicon-api.git cd favicon-api # Build and run docker build -t favicon-api . docker run -d \ -p 3000:3000 \ --name favicon-api \ --restart unless-stopped \ favicon-api # Verify it's running curl http://your-server-ip:3000/health
bash# Install Bun curl -fsSL https://bun.sh/install | bash # Clone and run git clone your-repo cd favicon-api bun install bun run start
Cloudflare Setup:
BunnyCDN Setup:
The API searches multiple sources for favicons:
<link rel="icon"> tags<link rel="apple-touch-icon"> tagsmanifest.json)/favicon.ico, /apple-touch-icon.png)Favicons are ranked by quality (size, format, source) and the best one is returned.
When the primary favicon fetch fails (e.g., due to bot protection), the API can optionally fall back to Google's favicon service:
USE_FALLBACK_API=true): Queries Google's favicon APIdefault.svg if no custom default is configured, or 404 when DEFAULT_IMAGE_URL=noneThe Google API fallback is enabled by default and provides reliable results even for sites with strict bot protection. To disable it, set USE_FALLBACK_API=false in your environment configuration.
The following projects are using the Favicon API:
Are you using the Favicon API and wanna be listed here? Feel free to file a Pull Request!
This project was mainly coded using Claude Code. We're also using the following libraries:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务