From 0ed175e403c2df236a480c3fb4dd8bd5f9514b12 Mon Sep 17 00:00:00 2001 From: KevinOomen Date: Wed, 29 May 2024 11:00:05 +0200 Subject: [PATCH] Added Dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0d64ef9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use the official ASP.NET runtime image as a base image +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 + +# Use the SDK image to build the application +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src + +# Copy the .csproj file and restore dependencies +COPY ["MusicService/MusicService.csproj", "MusicService/"] +RUN dotnet restore "MusicService/MusicService.csproj" + +# Copy the rest of the application code +COPY . . +WORKDIR "/src/MusicService" +RUN dotnet build "MusicService.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "MusicService.csproj" -c Release -o /app/publish + +# Use the base image to run the application +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "MusicService.dll"] \ No newline at end of file