Wie fügt man eine Asp C# .Net Web API in Docker hinzu
Hierzu fügt man eine Datei mit dem Namen Dockerfile hinzu
Zuvor sollte man in Visual Code die Docker Extension
hinzugefügt haben
Dann fügt man folgende Commands in die Dockerfile.
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT [ "dotnet","PlatformService.dll" ]
|