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

# RUN ln -s /lib/x86_64-linux-gnu/libdl-2.24.so /lib/x86_64-linux-gnu/libdl.so
#RUN apt-get update
#RUN apt-get install -y --no-install-recommends libgdiplus libc6-dev 


FROM microsoft/dotnet:2.1-sdk-alpine AS build
WORKDIR /src
COPY ["AutoTurnOver/AutoTurnOver.csproj", "AutoTurnOver/"]
COPY ["AutoTurnOver.Services/AutoTurnOver.Services.csproj", "AutoTurnOver.Services/"]
COPY ["AutoTurnOver.DB/AutoTurnOver.DB.csproj", "AutoTurnOver.DB/"]
COPY ["AutoTurnOver.Utility/AutoTurnOver.Utility.csproj", "AutoTurnOver.Utility/"]
COPY ["AutoTurnOver.Models/AutoTurnOver.Models.csproj", "AutoTurnOver.Models/"]
RUN dotnet restore "AutoTurnOver/AutoTurnOver.csproj"
COPY . .
WORKDIR "/src/AutoTurnOver"
RUN dotnet build "AutoTurnOver.csproj" -c Release -o /app

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

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