Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sungaila committed Sep 21, 2024
1 parent 410b02a commit 96999d5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
20 changes: 14 additions & 6 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
ENTRYPOINT ["./NewDarkGlobalServer"]
3 changes: 2 additions & 1 deletion src/NewDarkGlobalServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Configurations>Debug;Release;ReleaseSigned</Configurations>
<VersionPrefix>1.3.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PublishAot>true</PublishAot>
</PropertyGroup>

<!-- C# compiler -->
Expand Down Expand Up @@ -50,7 +51,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
</ItemGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"profiles": {
"NewDarkGlobalServer": {
"commandName": "Project"
"commandName": "Project",
"commandLineArgs": "--verbose"
},
"WSL": {
"commandName": "WSL2",
Expand Down

0 comments on commit 96999d5

Please sign in to comment.