临时提交

This commit is contained in:
cli 2025-04-27 11:04:31 +08:00
parent e866758782
commit d37e17d912
4 changed files with 47 additions and 9 deletions

View File

@ -22,25 +22,54 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV TZ=Asia/Shanghai
ENV ASPNETCORE_ENVIRONMENT=Production
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
WORKDIR "/src/host/JiShe.IOT.HttpApi.Host"
RUN dotnet build "JiShe.IOT.HttpApi.Host.csproj" -c Release -o /app/build
COPY ["JiShe.CollectBus.sln", "."]
COPY ["common.props", "."]
COPY ["NuGet.Config", "."]
COPY ["web/", "web/"]
COPY ["modules/", "modules/"]
COPY ["services/", "services/"]
COPY ["shared/", "shared/"]
COPY ["protocols/", "protocols/"]
# 恢复项目依赖
RUN dotnet restore "JiShe.CollectBus.sln"
# 构建项目
WORKDIR "/src/web/JiShe.CollectBus.Host"
RUN dotnet build "JiShe.CollectBus.Host.csproj" -c Release -o /app/build
# 发布项目
FROM build AS publish
RUN dotnet publish "JiShe.IOT.HttpApi.Host.csproj" -c Release -o /app/publish /p:UseAppHost=false
RUN dotnet publish "JiShe.CollectBus.Host.csproj" -c Release -o /app/publish /p:UseAppHost=false
# 创建最终镜像
FROM base AS final
WORKDIR /app
# 创建Plugins目录
RUN mkdir -p /app/Plugins
# 复制发布内容
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "JiShe.IOT.HttpApi.Host.dll"]
# 健康检查
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:80/health || exit 1
# 设置入口点
ENTRYPOINT ["dotnet", "JiShe.CollectBus.Host.dll"]
# 启动命令
# 可选:添加命令行参数
# CMD ["--urls", "http://+:80"]

View File

@ -62,6 +62,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.Docs", "0.Docs", "{D8346C
.gitignore = .gitignore
Dockerfile = Dockerfile
NuGet.Config = NuGet.Config
PackageAndPublish.bat = PackageAndPublish.bat
readme.md = readme.md
EndProjectSection
EndProject

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -141,5 +141,5 @@
"DefaultIdempotence": true
}
},
"PlugInFolder": "C:\\Users\\Dai Zan\\Desktop\\Plugins"
"PlugInFolder": ""
}