FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

FROM microsoft/dotnet:2.1-sdk 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

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

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