#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/core/runtime:3.1-buster-slim AS base
WORKDIR /app
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["Bailun.DC.DailyStockAge/Bailun.DC.DailyStockAge.csproj", "Bailun.DC.DailyStockAge/"]
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.DailyStockAge/Bailun.DC.DailyStockAge.csproj"
COPY . .
WORKDIR "/src/Bailun.DC.DailyStockAge"
RUN dotnet build "Bailun.DC.DailyStockAge.csproj" -c Release -o /app/build

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

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