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 SkuWHRedundancyService/SkuWHRedundancyService.csproj SkuWHRedundancyService/
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 SkuWHRedundancyService/SkuWHRedundancyService.csproj
COPY . .
WORKDIR /src/SkuWHRedundancyService
RUN dotnet build SkuWHRedundancyService.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish SkuWHRedundancyService.csproj -c Release -o /app

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