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

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more