From a47db464f847889a1c478e6ecf7fecf2384cabd3 Mon Sep 17 00:00:00 2001 From: Mateleo Date: Fri, 22 Nov 2024 00:23:14 +0100 Subject: [PATCH] feat(Dockerfile): add Dockerfile to containerize the .NET application chore(Blizzless.csproj): update project configuration to support multiple runtime identifiers for better cross-platform compatibility --- Dockerfile | 25 +++++++++++++++++++++++++ src/DiIiS-NA/Blizzless.csproj | 1 + 2 files changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b175de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Use the official .NET SDK image to build the application +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /app + +# Copy the project file and restore dependencies +COPY ["src/DiIiS-NA/Blizzless.csproj", "src/DiIiS-NA/"] +RUN dotnet restore "src/DiIiS-NA/Blizzless.csproj" + +# Copy the rest of the project files and build the application +COPY ["src/", "src/"] +WORKDIR "/app/src/DiIiS-NA" +RUN dotnet build "Blizzless.csproj" -c Release --runtime linux-x64 -o /app/publish + +# Use the official .NET runtime image to run the application +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime +WORKDIR /app + +# Copy the published application from the build stage +COPY --from=build /app/publish . + +# Expose the port your application is running on (if needed) +EXPOSE 5000 + +# Start the application +ENTRYPOINT ["./Blizzless"] \ No newline at end of file diff --git a/src/DiIiS-NA/Blizzless.csproj b/src/DiIiS-NA/Blizzless.csproj index 1a19163..92625c6 100644 --- a/src/DiIiS-NA/Blizzless.csproj +++ b/src/DiIiS-NA/Blizzless.csproj @@ -11,6 +11,7 @@ DiIiS_NA.Program full Debug;Release;github + win-x64;linux-x64