#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/aspnet:2.1 AS base
WORKDIR /app
EXPOSE 80
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build
WORKDIR /src
COPY ["Bailun.DC.Web/Bailun.DC.Web.csproj", "Bailun.DC.Web/"]
COPY ["Bailun.DC.Services/Bailun.DC.Services.csproj", "Bailun.DC.Services/"]
COPY ["Bailun.DC.Common/Bailun.DC.Common.csproj", "Bailun.DC.Common/"]
COPY ["Bailun.DC.DB/Bailun.DC.DB.csproj", "Bailun.DC.DB/"]
COPY ["Bailun.DC.Models/Bailun.DC.Models.csproj", "Bailun.DC.Models/"]
RUN dotnet restore "Bailun.DC.Web/Bailun.DC.Web.csproj"
COPY . .
WORKDIR "/src/Bailun.DC.Web"
RUN dotnet build "Bailun.DC.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Bailun.DC.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Bailun.DC.Web.dll"]