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.SkuDailyPurchaseAndSales/Bailun.DC.SkuDailyPurchaseAndSales.csproj Bailun.DC.SkuDailyPurchaseAndSales/
COPY Bailun.DC.Common/Bailun.DC.Common.csproj Bailun.DC.Common/
COPY Bailun.DC.Models/Bailun.DC.Models.csproj Bailun.DC.Models/
RUN dotnet restore Bailun.DC.SkuDailyPurchaseAndSales/Bailun.DC.SkuDailyPurchaseAndSales.csproj
COPY . .
WORKDIR /src/Bailun.DC.SkuDailyPurchaseAndSales
RUN dotnet build Bailun.DC.SkuDailyPurchaseAndSales.csproj -c Release -o /app

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

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