FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY VigilAIWeb.csproj ./
RUN dotnet restore VigilAIWeb.csproj
COPY . ./
# Debug symbols are KEPT by default: without a .pdb, a production stack trace loses its
# file names and line numbers, which is a real cost when diagnosing a live incident.
# Customer bundles pass PUBLISH_DEBUG=none, because a .pdb hands a decompiler the
# original method and local-variable names -- see deploy/onprem/build-bundle.sh.
ARG PUBLISH_DEBUG=portable
RUN dotnet publish VigilAIWeb.csproj -c Release -o /app/publish --no-restore /p:UseAppHost=false /p:DebugType=${PUBLISH_DEBUG} /p:GenerateDocumentationFile=false

FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN apt-get update \
 && apt-get install -y --no-install-recommends curl \
 && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app/publish ./
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "VigilAIWeb.dll"]
