FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app

# Copy entire solution and dependencies
COPY . /app

# Restore dependencies
RUN dotnet restore

# Build the solution
RUN dotnet build -c Release

# Publish the application
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .


# Set the entry point for the console app
ENTRYPOINT ["dotnet", "{projectName}.Consumer.dll"]
