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
This commit is contained in:
Mateleo 2024-11-22 00:23:14 +01:00
parent 9730b68779
commit a47db464f8
2 changed files with 26 additions and 0 deletions

25
Dockerfile Normal file
View File

@ -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"]

View File

@ -11,6 +11,7 @@
<StartupObject>DiIiS_NA.Program</StartupObject>
<DebugType>full</DebugType>
<Configurations>Debug;Release;github</Configurations>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">