DEV Community

MustafaSamedYeyin
MustafaSamedYeyin

Posted on

Docker Notlarım 2 :

Docker ile dotnet console uygulaması :

Boş bir dizin açıp :

  • Adım 1 :

dotnet new console

Image description

Image description

  • Adım 2 : Dockerfile dosyasını ekleyelim :
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /App

# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /App
COPY --from=build-env /App/out .
ENTRYPOINT ["dotnet", "DevTo.dll"]
Enter fullscreen mode Exit fullscreen mode

Image description

  • Adım 3 :

docker build .

Image description

  • Adım 4 :

docker run 1087498a58a5dbe945d83c57e3a1d53b4f29c1a4abeff16cac3e62b6167b353c

Image description

Sonuç : "Hello, World!" yazısını görmüş olduk.

Image description

Top comments (0)