diff --git a/.dockerignore b/.dockerignore
index 3729ff0..74aebb0 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,25 +1,9 @@
-**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
-**/.project
-**/.settings
-**/.toolstarget
**/.vs
**/.vscode
-**/*.*proj.user
-**/*.dbmdl
-**/*.jfm
-**/azds.yaml
**/bin
-**/charts
-**/docker-compose*
-**/Dockerfile*
-**/node_modules
-**/npm-debug.log
**/obj
-**/secrets.dev.yaml
-**/values.dev.yaml
-LICENSE
-README.md
\ No newline at end of file
+**/appsettings.Development.json
diff --git a/Dockerfile b/Dockerfile
index 201b29f..0069c48 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,40 +1,48 @@
-#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
-
-FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
-
-#ÐÄapt-getԴ£¬¼ÓËÙaptÏÂÔØ
-#RUN sed -i s@/deb.debian.org/@/mirrors.163.com/@g /etc/apt/sources.list.d/debian.sources
-#RUN cat /etc/apt/sources.list
-#°²װfontconfig
-RUN apt-get clean
-RUN apt-get update
-RUN apt-get install -y fontconfig
-
+# 基于.NET 8官方Linux镜像的多阶段构建
+FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
-EXPOSE 8066
-EXPOSE 443
+EXPOSE 9996
-FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
+# 设置时区
+ENV TZ=Asia/Shanghai
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+# 安装必要的依赖(如字体库,适配MiniExcel等)
+RUN apt-get update && apt-get install -y fontconfig && apt-get clean
+
+# 构建阶段
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+ARG BUILD_CONFIGURATION=Release
WORKDIR /src
-COPY ["Easy.Admin.Web.Entry/Easy.Admin.Web.Entry.csproj", "Easy.Admin.Web.Entry/"]
-COPY ["Easy.Admin.Web.Core/Easy.Admin.Web.Core.csproj", "Easy.Admin.Web.Core/"]
-COPY ["Easy.Admin.Application/Easy.Admin.Application.csproj", "Easy.Admin.Application/"]
-COPY ["Easy.Admin.Core/Easy.Admin.Core.csproj", "Easy.Admin.Core/"]
-RUN dotnet restore "Easy.Admin.Web.Entry/Easy.Admin.Web.Entry.csproj"
+
+# 复制csproj文件并还原
+COPY ["YD_Event.Web.Entry/YD_Event.Web.Entry.csproj", "YD_Event.Web.Entry/"]
+COPY ["YD_Event.Web.Core/YD_Event.Web.Core.csproj", "YD_Event.Web.Core/"]
+COPY ["YD_Event.Application/YD_Event.Application.csproj", "YD_Event.Application/"]
+COPY ["YD_Event.Core/YD_Event.Core.csproj", "YD_Event.Core/"]
+
+RUN dotnet restore "YD_Event.Web.Entry/YD_Event.Web.Entry.csproj"
+
+# 复制所有源码
COPY . .
-WORKDIR "/src/Easy.Admin.Web.Entry"
-RUN dotnet build "Easy.Admin.Web.Entry.csproj" -c Release -o /app/build
+WORKDIR "/src/YD_Event.Web.Entry"
+RUN dotnet build "YD_Event.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/build
+# 发布阶段
FROM build AS publish
-RUN dotnet publish "Easy.Admin.Web.Entry.csproj" -c Release -o /app/publish /p:UseAppHost=false
+ARG BUILD_CONFIGURATION=Release
+RUN dotnet publish "YD_Event.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
+# 运行阶段
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
-# ÉèÖÃʱÇø
-ENV TZ=Asia/Shanghai
-ENV ASPNETCORE_URLS 'http://*:8066'
+# 配置Kestrel端口
+ENV ASPNETCORE_URLS=http://*:9996
-ENTRYPOINT ["dotnet", "Easy.Admin.Web.Entry.dll"]
\ No newline at end of file
+# 健康检查
+HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
+ CMD curl -f http://localhost:9996/health || exit 1
+
+ENTRYPOINT ["dotnet", "YD_Event.Web.Entry.dll"]
diff --git a/YD_Event.Web.Core/Startup.cs b/YD_Event.Web.Core/Startup.cs
index 8ae7b67..1e3b731 100644
--- a/YD_Event.Web.Core/Startup.cs
+++ b/YD_Event.Web.Core/Startup.cs
@@ -1,4 +1,4 @@
-using Furion;
+using Furion;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@@ -60,6 +60,8 @@ public class Startup : AppStartup
});
services.AddConsoleFormatter();
+ // 添加健康检查
+ services.AddHealthChecks();
// 全局日志 文档:http://furion.baiqian.ltd/docs/logging/#18116-%E8%BE%93%E5%87%BA-json-%E6%94%AF%E6%8C%81%E5%BF%BD%E7%95%A5%E5%B1%9E%E6%80%A7%E5%90%8D%E6%88%96%E5%B1%9E%E6%80%A7%E7%B1%BB%E5%9E%8B
services.AddMonitorLogging(options =>
@@ -215,6 +217,7 @@ public class Startup : AppStartup
app.UseEndpoints(endpoints =>
{
+ endpoints.MapHealthChecks("/health");
endpoints.MapControllers();
});
}
diff --git a/YD_Event.Web.Entry/Program.cs b/YD_Event.Web.Entry/Program.cs
index 65ae485..bd526bf 100644
--- a/YD_Event.Web.Entry/Program.cs
+++ b/YD_Event.Web.Entry/Program.cs
@@ -1 +1,8 @@
-Serve.Run(RunOptions.Default.WithArgs(args));
+Serve.Run(RunOptions.Default
+ .WithArgs(args)
+ .ConfigureBuilder(builder =>
+ {
+ // 确保容器内绑定到所有IP,端口9996
+ builder.WebHost.UseUrls("http://*:9996");
+ })
+);
diff --git a/YD_Event.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml b/YD_Event.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..bd30982
--- /dev/null
+++ b/YD_Event.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,15 @@
+
+
+
+
+ false
+ false
+ true
+ Release
+ Any CPU
+ FileSystem
+ D:\发布\EventServer
+ FileSystem
+ <_TargetId>Folder
+
+
\ No newline at end of file
diff --git a/YD_Event.Web.Entry/YD_Event.Web.Entry.csproj.user b/YD_Event.Web.Entry/YD_Event.Web.Entry.csproj.user
index ebba491..90f660e 100644
--- a/YD_Event.Web.Entry/YD_Event.Web.Entry.csproj.user
+++ b/YD_Event.Web.Entry/YD_Event.Web.Entry.csproj.user
@@ -5,5 +5,6 @@
YD_Event.Web.Entry
+ F:\项目\YD\YD_Event.Admin\YD_Event.Web.Entry\Properties\PublishProfiles\FolderProfile.pubxml
\ No newline at end of file
diff --git a/YD_Event.Web.Entry/appsettings.json b/YD_Event.Web.Entry/appsettings.json
index 52b1a4e..c3446b4 100644
--- a/YD_Event.Web.Entry/appsettings.json
+++ b/YD_Event.Web.Entry/appsettings.json
@@ -7,6 +7,13 @@
"Microsoft.EntityFrameworkCore": "Information"
}
},
+ "Kestrel": {
+ "Endpoints": {
+ "Http": {
+ "Url": "http://*:9996"
+ }
+ }
+ },
"AllowedHosts": "*",
"ConnectionConfigs": [
{