diff --git a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs index e6d88804d8606f30dd69cad2da1e1fd216381c3c..f5a0fa04185e01e593c74fd334012c88d85324f8 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs @@ -1,4 +1,4 @@ -using Lazy.Captcha.Core; +using Lazy.Captcha.Core; using Microsoft.AspNetCore.Mvc; using ZR.Admin.WebApi.Filters; using ZR.Infrastructure.Helper; @@ -141,9 +141,9 @@ namespace ZR.Admin.WebApi.Controllers.System SysConfig sysConfig = sysConfigService.GetSysConfigByKey("sys.account.captchaOnOff"); var captchaOff = sysConfig?.ConfigValue ?? "0"; - var info = SecurityCodeHelper.Generate(uuid, 60); - var obj = new { captchaOff, uuid, img = info.Base64 };// File(stream, "image/png") - + CaptchaData? info = null; + if(captchaOff == "0") info = SecurityCodeHelper.Generate(uuid, 60); + var obj = new { captchaOff, uuid, img = info?.Base64 };// File(stream, "image/png") return SUCCESS(obj); } diff --git a/ZR.Admin.WebApi/Dockerfile b/ZR.Admin.WebApi/Dockerfile index e62587c5310d6be37c5f269b4e756a4fa18863d6..4079850aefef33b6aed911d67d7f23bf0ddad45c 100644 --- a/ZR.Admin.WebApi/Dockerfile +++ b/ZR.Admin.WebApi/Dockerfile @@ -1,4 +1,7 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +#FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +#dotnet core 默认镜像无法生成图片 +FROM cosmoeky/dotnet7.0:20231208 AS build + #创建 /app文件夹 WORKDIR /app #创建挂载目录,用于将程序部署在服务器本地 @@ -7,15 +10,18 @@ WORKDIR /app EXPOSE 8888 VOLUME /app/logs #COPY bin/Release/net5.0/publish/ app/ -COPY . app/ +COPY . /app/ #设置容器内的时区,如果不设置,默认时区是标准时间比北京时间晚8个小时 -RUN echo "Asia/shanghai" > /etc/timezone -RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +#RUN echo "Asia/shanghai" > /etc/timezone +#RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +#已经打包到cosmoeky/dotnet7.0里面了 + + # 复制发布文件到工作目录 #COPY . app/ WORKDIR /app #等价于 dotnet ZR.Admin.WebApi.dll,如果不指定启动端口默认在docker里面启动端口是80端口 -ENTRYPOINT ["dotnet", "ZR.Admin.WebApi.dll", "--server.urls","http://*:8888"] \ No newline at end of file +ENTRYPOINT ["dotnet", "ZR.Admin.WebApi.dll", "--server.urls","http://*:8888"]