From 53336f2a7568a5a2cddc69e98649cc050060943e Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 24 Apr 2020 13:45:05 -0400 Subject: [PATCH] Add VS docker debug support --- src/Tgstation.Server.Host/Dockerfile | 24 +++++++++++++++++++ .../Properties/launchSettings.json | 10 +++++--- .../Tgstation.Server.Host.csproj | 3 +++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/Tgstation.Server.Host/Dockerfile diff --git a/src/Tgstation.Server.Host/Dockerfile b/src/Tgstation.Server.Host/Dockerfile new file mode 100644 index 0000000000..3e1b6d9178 --- /dev/null +++ b/src/Tgstation.Server.Host/Dockerfile @@ -0,0 +1,24 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# THIS SHOULD NOT BE USED TO CREATE THE PRODUCTION BUILD IT'S FOR DEBUGGING ONLY + +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build +WORKDIR /src +COPY ["src/Tgstation.Server.Host/Tgstation.Server.Host.csproj", "src/Tgstation.Server.Host/"] +COPY ["src/Tgstation.Server.Api/Tgstation.Server.Api.csproj", "src/Tgstation.Server.Api/"] +RUN dotnet restore "src/Tgstation.Server.Host/Tgstation.Server.Host.csproj" +COPY . . +WORKDIR "/src/src/Tgstation.Server.Host" +RUN dotnet build "Tgstation.Server.Host.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Tgstation.Server.Host.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Tgstation.Server.Host.dll"] diff --git a/src/Tgstation.Server.Host/Properties/launchSettings.json b/src/Tgstation.Server.Host/Properties/launchSettings.json index 3665dcfc22..8ed172fae4 100644 --- a/src/Tgstation.Server.Host/Properties/launchSettings.json +++ b/src/Tgstation.Server.Host/Properties/launchSettings.json @@ -2,11 +2,15 @@ "profiles": { "Tgstation.Server.Host": { "commandName": "Project", - "launchBrowser": false, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development", - "DOTNET_ENVIRONMENT": "Development" + "DOTNET_ENVIRONMENT": "Development", + "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true } } } \ No newline at end of file diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 243f4f4c32..bfcd9dc733 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -26,6 +26,8 @@ ClientApp/node_modules ClientApp/node_modules/.install-stamp + Linux + ..\.. @@ -68,6 +70,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive +