
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
本镜像基于Clean Architecture原则构建Blazor Server应用,具备复杂用户界面和高效代码生成器,支持多种数据库和身份验证方式,旨在帮助开发者快速创建基于.NET Blazor技术的Web应用。
适用于需要快速开发企业级Web应用的团队,特别是需要遵循Clean Architecture设计模式、要求多数据库支持或第三方身份验证集成的项目。可用于内部管理系统、数据仪表盘、业务应用等场景。
可通过以下链接体验应用功能:
拉取镜像
bashdocker pull blazordevlab/cleanarchitectureblazorserver:latest
运行容器
开发模式(内存数据库):
bashdocker run -p 8443:443 -e UseInMemoryDatabase=true -e ASPNETCORE_ENVIRONMENT=Development -e ASPNETCORE_HTTPS_PORTS=443 blazordevlab/cleanarchitectureblazorserver:latest
生产模式(持久化数据库和SMTP配置):
bashdocker run -d -p 8443:443 \ -e UseInMemoryDatabase=false \ -e ASPNETCORE_ENVIRONMENT=Development \ -e ASPNETCORE_HTTP_PORTS=80 \ -e ASPNETCORE_HTTPS_PORTS=443 \ -e DatabaseSettings__DBProvider=mssql \ -e DatabaseSettings__ConnectionString="Server=127.0.0.1;Database=BlazorDashboardDb;User Id=sa;Password=<YourPassword>;MultipleActiveResultSets=true;Encrypt=false;TrustServerCertificate=false" \ -e SmtpClientOptions__User=<YourSMTPUser> \ -e SmtpClientOptions__Port=25 \ -e SmtpClientOptions__Server=<YourSMTPServer> \ -e SmtpClientOptions__Password=<YourSMTPPassword> \ -e Authentication__Microsoft__ClientId=<YourMicrosoftClientId> \ -e Authentication__Microsoft__ClientSecret=<YourMicrosoftClientSecret> \ -e Authentication__Google__ClientId=<YourGoogleClientId> \ -e Authentication__Google__ClientSecret=<YourGoogleClientSecret> \ -e Authentication__Facebook__AppId=<YourFacebookAppId> \ -e Authentication__Facebook__AppSecret=<YourFacebookAppSecret> \ blazordevlab/cleanarchitectureblazorserver:latest
替换
<Your...>占位符为实际配置值
Docker Compose配置
创建docker-compose.yml文件进行更便捷的管理:
yamlversion: '3.8' services: blazorserverapp: image: blazordevlab/cleanarchitectureblazorserver:latest environment: - UseInMemoryDatabase=false - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://+:80;https://+:443 - ASPNETCORE_HTTP_PORTS=80 - ASPNETCORE_HTTPS_PORTS=443 - DatabaseSettings__DBProvider=mssql - DatabaseSettings__ConnectionString=Server=sqlserver;Database=BlazorDashboardDb;User Id=sa;Password=YourStrongPassword!;MultipleActiveResultSets=true;Encrypt=false;TrustServerCertificate=false - SmtpClientOptions__User=<YourSMTPUser> - SmtpClientOptions__Port=25 - SmtpClientOptions__Server=<YourSMTPServer> - SmtpClientOptions__Password=<YourSMTPPassword> - Authentication__Microsoft__ClientId=<YourMicrosoftClientId> - Authentication__Microsoft__ClientSecret=<YourMicrosoftClientSecret> - Authentication__Google__ClientId=<YourGoogleClientId> - Authentication__Google__ClientSecret=<YourGoogleClientSecret> - Authentication__Facebook__AppId=<YourFacebookAppId> - Authentication__Facebook__AppSecret=<YourFacebookAppSecret> ports: - "8443:443" volumes: - files_volume:/app/Files depends_on: - sqlserver sqlserver: image: mcr.microsoft.com/mssql/server:2022-latest environment: - ACCEPT_EULA=Y - MSSQL_SA_PASSWORD=YourStrongPassword! ports: - "1433:1433" volumes: - sql_volume:/var/opt/mssql volumes: files_volume: sql_volume:
files_volume用于持久化存储应用文件,可根据需求调整或扩展卷配置
配置第三方身份验证提供商,请参考以下官方文档:
postgresql)mssql)sqlite)选择特定数据库的方法
Server.UI项目src目录下的appsettings.json文件DBProvider设置为所需的提供商名称(见上述支持的数据库)ConnectionString修改为适用于所选数据库提供商的连接字符串创建自签名开发证书:
bashdotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\CleanArchitecture.Blazor.Server.UI.pfx -p Password@123 dotnet dev-certs https --trust
管理用户密钥以保存密码:
bashdotnet user-secrets init dotnet user-secrets -p Server.UI.csproj set "Kestrel:Certificates:Development:Password" "Password@123"
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务