#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS baseWORKDIR /appEXPOSE 80EXPOSE 443RUN echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib \deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib \deb http://mirrors.aliyun.com/debian-security stretch/updates main \deb-src http://mirrors.aliyun.com/debian-security stretch/updates main \deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib \deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" > /etc/apt/sources.list RUN apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dllFROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS buildWORKDIR /srcCOPY ["xxx/xxx.csproj", "xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]COPY ["xxx/xxx.xxx.csproj", "xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]RUN dotnet restore "xxx/xxx.csproj"COPY . .WORKDIR "/src/xxx"RUN dotnet build "xxx.csproj" -c Release -o /app/buildFROM build AS publishRUN dotnet publish "xxx.csproj" -c Release -o /app/publishFROM base AS finalWORKDIR /appCOPY --from=publish /app/publish .ENTRYPOINT ["dotnet", "xxx.dll"]
参考文章:https://www.cnblogs.com/stulzq/p/10172550.html
https://www.cnblogs.com/stulzq/p/9339250.html