dockerfile测试例子
#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 127.0.0.1/basic/mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
FROM 127.0.0.1/basic/mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/Services/Test.Service.AdminWeb.Api/Test.Service.AdminWeb.Api.csproj", "src/Services/Test.Service.AdminWeb.Api/"]
COPY ["src/BuildingBlocks/Test.Entities/Test.Entities.csproj", "src/BuildingBlocks/Test.Entities/"]
COPY ["src/BuildingBlocks/Test.Enums/Test.Enums.csproj", "src/BuildingBlocks/Test.Enums/"]
COPY ["src/BuildingBlocks/Test.Files/Test.Files.csproj", "src/BuildingBlocks/Test.Files/"]
COPY ["src/BuildingBlocks/Test.SqlSugars/Test.SqlSugars.csproj", "src/BuildingBlocks/Test.SqlSugars/"]
COPY ["src/BuildingBlocks/Test.Models/Test.Models.csproj", "src/BuildingBlocks/Test.Models/"]
COPY ["src/BuildingBlocks/Test.Utils/Test.Utils.csproj", "src/BuildingBlocks/Test.Utils/"]
COPY ["src/BuildingBlocks/Test.Web/Test.Web.csproj", "src/BuildingBlocks/Test.Web/"]
COPY ["src/BuildingBlocks/Test.Exceptions/Test.Exceptions.csproj", "src/BuildingBlocks/Test.Exceptions/"]
RUN dotnet nuget remove source nuget.org
RUN dotnet nuget add source https://127.0.0.1/repository/nuget-group/index.json -n "HNKC.nuget"
RUN dotnet restore "./src/Services/Test.Service.AdminWeb.Api/Test.Service.AdminWeb.Api.csproj"
COPY . .
WORKDIR "/src/src/Services/Test.Service.AdminWeb.Api"
RUN dotnet build "./Test.Service.AdminWeb.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Test.Service.AdminWeb.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Test.Service.AdminWeb.Api.dll"]
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?