FROM microsoft/dotnet:2.1-runtime AS base
WORKDIR /app
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.LogicWareHouse/Bailun.DC.LogicWareHouse.csproj Bailun.DC.LogicWareHouse/
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.LogicWareHouse/Bailun.DC.LogicWareHouse.csproj
COPY . .
WORKDIR /src/Bailun.DC.LogicWareHouse
RUN dotnet build Bailun.DC.LogicWareHouse.csproj -c Release -o /app

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

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