diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cd967fc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*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 new file mode 100644 index 0000000..a144840 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2022 AS base +USER $APP_UID +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["NuGet.config", "."] +COPY ["Directory.Build.props", "."] +COPY ["Torch.API/Torch.API.csproj", "Torch.API/"] +COPY ["Torch/Torch.csproj", "Torch/"] +COPY ["Torch.Server/Torch.Server.csproj", "Torch.Server/"] +RUN dotnet restore "Torch.Server/Torch.Server.csproj" --locked-mode +COPY . . +WORKDIR "/src/Torch.Server" +RUN dotnet build "Torch.Server.csproj" -c %BUILD_CONFIGURATION% -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "Torch.Server.csproj" -c %BUILD_CONFIGURATION% -o /app/publish --no-self-contained /p:UseAppHost=false + +FROM mcr.microsoft.com/windows/servercore:ltsc2022 + +ADD ["https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe", "installer.exe"] + +RUN installer.exe /install /quiet /norestart && del installer.exe + +ADD ["https://github.com/abbodi1406/vcredist/releases/latest/download/VisualCppRedist_AIO_x86_x64.exe", "vc.exe"] + +USER ContainerAdministrator + +RUN vc.exe /ai39 && del vc.exe + +USER ContainerUser + +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Torch.Server.dll"]