# SQLInsight Hub. Build from the repository root:
#   docker build -f deploy/hub/Dockerfile -t sqlinsight-hub .
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish src/SQLInsight.Hub -c Release -o /app

FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app .
# Keys for login cookies, and the update feed, live on volumes.
ENV ASPNETCORE_HTTP_PORTS=8080 \
    SQLInsight__Hub__DataProtectionKeysPath=/data/keys
RUN mkdir -p /data/keys /data/feed && chown -R $APP_UID /data
VOLUME ["/data"]
USER $APP_UID
EXPOSE 8080
ENTRYPOINT ["dotnet", "SQLInsight.Hub.dll"]
