From 0f47a14e69069493326483454da000cc31a8e3d2 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Tue, 29 Aug 2023 16:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 25 ++++++++++++++++++ Dockerfile | 11 +------- .../Controllers/UploadDownLoadController.cs | 12 ++++----- IRaCIS.Core.API/Dockerfile | 26 +++++++++++++++++++ IRaCIS.Core.API/IRaCIS.Core.API.csproj | 2 +- 5 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 .dockerignore create mode 100644 IRaCIS.Core.API/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..3729ff0cd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.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 diff --git a/Dockerfile b/Dockerfile index 45ee7591a..4cb188d79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,8 @@ #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. -#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed. -#For more information, please see https://aka.ms/containercompat - - - FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app -EXPOSE 7050 - +EXPOSE 80 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src @@ -29,7 +23,4 @@ RUN dotnet publish "IRaCIS.Core.API.csproj" -c Release -o /app/publish /p:UseApp FROM base AS final WORKDIR /app COPY --from=publish /app/publish . - -ENV ASPNETCORE_ENVIRONMENT=Development - ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"] \ No newline at end of file diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index cca839939..ed89ecc45 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -985,7 +985,7 @@ namespace IRaCIS.Core.API.Controllers if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) { - throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); + throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_TemplateUploadData")); } (serverFilePath, relativePath) = FileStoreHelper.GetOtherFileUploadPath(_hostEnvironment, StaticData.Folder.TempFile, fileName); @@ -1000,30 +1000,30 @@ namespace IRaCIS.Core.API.Controllers if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) { - throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); + throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_EnsureCompleteData")); } var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim().ToUpper()).Distinct().ToList(); if (_trialSiteRepository.Where(t => t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode.ToUpper())).Count() != siteCodeList.Count) { - throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); + throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_InvalidCenters")); } if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) { - throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); + throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_CheckDuplicateAccounts")); } if (excelList.Any(t => !t.Email.Contains("@"))) { - throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); + throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_InvalidEmail")); } var generateUserTypeList = new List() { "CRC", "SR", "CRA" }; if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) { - throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); + throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_InvalidUserType")); } //处理好 用户类型 和用户类型枚举 diff --git a/IRaCIS.Core.API/Dockerfile b/IRaCIS.Core.API/Dockerfile new file mode 100644 index 000000000..4cb188d79 --- /dev/null +++ b/IRaCIS.Core.API/Dockerfile @@ -0,0 +1,26 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["IRaCIS.Core.API/IRaCIS.Core.API.csproj", "IRaCIS.Core.API/"] +COPY ["IRaCIS.Core.Application/IRaCIS.Core.Application.csproj", "IRaCIS.Core.Application/"] +COPY ["IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj", "IRaCIS.Core.Infra.EFCore/"] +COPY ["IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj", "IRaCIS.Core.Domain/"] +COPY ["IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj", "IRaCIS.Core.Domain.Share/"] +COPY ["IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj", "IRaCIS.Core.Infrastructure/"] +RUN dotnet restore "IRaCIS.Core.API/IRaCIS.Core.API.csproj" +COPY . . +WORKDIR "/src/IRaCIS.Core.API" +RUN dotnet build "IRaCIS.Core.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "IRaCIS.Core.API.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"] \ No newline at end of file diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 74b76b158..18b7d2ed3 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -5,7 +5,7 @@ false 354572d4-9e15-4099-807c-63a2d29ff9f2 default - Windows + Linux 1.0.1.001 上海展影医疗科技有限公司 IRC影像系统 (EICS)