#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/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WeatherForecast/WeatherForecast.csproj", "WeatherForecast/"]
COPY ["Services/FileSecurityService/FileSecurityService.csproj", "Services/FileSecurityService/"]
COPY ["Extensions/Extensions.csproj", "Extensions/"]
COPY ["Core/Core.csproj", "Core/"]
COPY ["Services/ImageProvider/ImageProvider.csproj", "Services/ImageProvider/"]
COPY ["DataProviders/DataProviders.csproj", "DataProviders/"]
COPY ["Services/JWTService/JWTService.csproj", "Services/JWTService/"]
COPY ["Services/HashService/HashService.csproj", "Services/HashService/"]
RUN dotnet restore "WeatherForecast/WeatherForecast.csproj"
COPY . .
WORKDIR "/src/WeatherForecast"
RUN dotnet build "WeatherForecast.csproj" -c Release -o /app/build

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

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