首页 > 其他分享 >用Docker发布网站时,自动下载Directory.Build.props及其Import的文件

用Docker发布网站时,自动下载Directory.Build.props及其Import的文件

时间:2024-02-28 18:45:41浏览次数:23  
标签:src csproj Yee Build props Directory Blazor PayPortal Change

为Blazor网站项目,“添加Docker支持”

img

img

这时,网站项目根目录下会新增Dockerfile。

img

#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:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["NuGet.Config", "."]
COPY ["src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj", "src/Yee.Change.PayPortal.Blazor/"]
COPY ["src/Yee.Change.PayPortal.Application/Yee.Change.PayPortal.Application.csproj", "src/Yee.Change.PayPortal.Application/"]
COPY ["src/Yee.Change.PayPortal.Domain/Yee.Change.PayPortal.Domain.csproj", "src/Yee.Change.PayPortal.Domain/"]
COPY ["src/Yee.Change.PayPortal.Domain.Shared/Yee.Change.PayPortal.Domain.Shared.csproj", "src/Yee.Change.PayPortal.Domain.Shared/"]
COPY ["src/Yee.Change.PayPortal.Application.Contracts/Yee.Change.PayPortal.Application.Contracts.csproj", "src/Yee.Change.PayPortal.Application.Contracts/"]
COPY ["src/Yee.Change.PayPortal.HttpApi/Yee.Change.PayPortal.HttpApi.csproj", "src/Yee.Change.PayPortal.HttpApi/"]
COPY ["src/Yee.Change.PayPortal.EntityFrameworkCore/Yee.Change.PayPortal.EntityFrameworkCore.csproj", "src/Yee.Change.PayPortal.EntityFrameworkCore/"]
RUN dotnet restore "./src/Yee.Change.PayPortal.Blazor/Yee.Change.PayPortal.Blazor.csproj"
COPY . .
WORKDIR "/src/src/Yee.Change.PayPortal.Blazor"
RUN dotnet build "./Yee.Change.PayPortal.Blazor.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Yee.Change.PayPortal.Blazor.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Yee.Change.PayPortal.Blazor.dll"]

标签:src,csproj,Yee,Build,props,Directory,Blazor,PayPortal,Change
From: https://www.cnblogs.com/amisoft/p/18041418

相关文章