From 96999d538cf0254267a7f20047271580423fc4b1 Mon Sep 17 00:00:00 2001 From: David Sungaila Date: Sat, 21 Sep 2024 20:00:37 +0200 Subject: [PATCH] Update Dockerfile --- src/Dockerfile | 20 ++++++++++++++------ src/NewDarkGlobalServer.csproj | 3 ++- src/Properties/launchSettings.json | 3 ++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 7e90d31..1863d3b 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,24 +1,32 @@ -#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. +ARG LAUNCHING_FROM_VS +ARG FINAL_BASE_IMAGE=${LAUNCHING_FROM_VS:+aotdebug} FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base -EXPOSE 5199 USER app WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build +RUN apk update \ + && apk add build-base zlib-dev ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["src/NewDarkGlobalServer.csproj", "src/"] -RUN dotnet restore "./src/./NewDarkGlobalServer.csproj" +RUN dotnet restore "./src/NewDarkGlobalServer.csproj" COPY . . WORKDIR "/src/src" RUN dotnet build "./NewDarkGlobalServer.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./NewDarkGlobalServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false +RUN dotnet publish "./NewDarkGlobalServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=true -FROM base AS final +FROM base as aotdebug +USER root +RUN apk update \ + && apk add gdb +USER app + +FROM ${FINAL_BASE_IMAGE:-mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine} AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "NewDarkGlobalServer.dll", "-t"] \ No newline at end of file +ENTRYPOINT ["./NewDarkGlobalServer"] \ No newline at end of file diff --git a/src/NewDarkGlobalServer.csproj b/src/NewDarkGlobalServer.csproj index e3d8ec5..4b04b60 100644 --- a/src/NewDarkGlobalServer.csproj +++ b/src/NewDarkGlobalServer.csproj @@ -11,6 +11,7 @@ Debug;Release;ReleaseSigned 1.3.1 + true @@ -50,7 +51,7 @@ - + diff --git a/src/Properties/launchSettings.json b/src/Properties/launchSettings.json index fe0a0f4..2cbcfb2 100644 --- a/src/Properties/launchSettings.json +++ b/src/Properties/launchSettings.json @@ -1,7 +1,8 @@ { "profiles": { "NewDarkGlobalServer": { - "commandName": "Project" + "commandName": "Project", + "commandLineArgs": "--verbose" }, "WSL": { "commandName": "WSL2",