FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
ENV ASPNETCORE_URLS=http://0.0.0.0:8010
WORKDIR /app
EXPOSE 8010

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

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

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