#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
RUN mkdir /testmanager
RUN mkdir /testmanager/backend
WORKDIR /testmanager/backend
EXPOSE 5000
ENV ASPNETCORE_URLS=http://*.5000

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["WebApiRunner/WebApiRunner.csproj", "WebApiRunner/"]
RUN dotnet restore "WebApiRunner/WebApiRunner.csproj"
COPY . .
WORKDIR "/src/WebApiRunner"
RUN dotnet build "WebApiRunner.csproj" -c Release -o /testmanager/backend/build

FROM build AS publish
RUN dotnet publish "WebApiRunner.csproj" -c Release -o /testmanager/backend/publish

FROM base AS final
WORKDIR /testmanager/backend
COPY --from=publish /testmanager/backend/publish .

RUN mkdir /testmanager/project
ENTRYPOINT ["dotnet", "WebApiRunner.dll"]