{"id":807,"date":"2020-06-24T08:30:00","date_gmt":"2020-06-24T05:30:00","guid":{"rendered":"http:\/\/localhost\/bilisimkurdu\/?p=807"},"modified":"2020-06-24T08:30:00","modified_gmt":"2020-06-24T05:30:00","slug":"asp-net-core-uygulamasini-heroku-ile-ucretsiz-yayinlamak","status":"publish","type":"post","link":"http:\/\/localhost\/bilisimkurdu\/asp-net-core-uygulamasini-heroku-ile-ucretsiz-yayinlamak\/","title":{"rendered":"ASP.NET Core Uygulamas\u0131n\u0131 Heroku ile \u00dccretsiz Yay\u0131nlamak"},"content":{"rendered":"\n

Merhaba Muhterem Ziyaret\u00e7ilerimiz,<\/p>\n\n\n\n

Bu yaz\u0131mda Heroku ile .NET CORE Web uygulamas\u0131na nas\u0131l yay\u0131mlanaca\u011f\u0131n\u0131 anlatmaya \u00e7al\u0131\u015faca\u011f\u0131m.<\/p>\n\n\n\n

Visual Studio \u00fczerinden haz\u0131rlanm\u0131\u015fsa:<\/p>\n\n\n\n

“%UserProfile%\\kullaniciAdi\\source\\repos\\projeAdi\\projeAdi” klas\u00f6r\u00fcne Dockerfile ve .circlei klas\u00f6r\u00fcn\u00fc ekliyoruz.<\/p>\n\n\n\n\n\n\n\n

Dockerfile<\/strong> i\u00e7eri\u011fi<\/p>\n\n\n\n

FROM mcr.microsoft.com\/dotnet\/core\/sdk:3.1 AS build-env\nWORKDIR \/app\n\n# Copy csproj and restore as distinct layers\nCOPY *.csproj .\/\nRUN dotnet restore\n\n# Copy everything else and build\nCOPY . .\/\nRUN dotnet publish -c Release -o out\n\n# Build runtime image\nFROM mcr.microsoft.com\/dotnet\/core\/aspnet:3.1\nWORKDIR \/app\nCOPY --from=build-env \/app\/out .\nCMD ASPNETCORE_URLS=http:\/\/*:$PORT .\/projeAdi<\/code><\/pre>\n\n\n\n

.circleci\\config.yml<\/strong> i\u00e7eri\u011fi<\/p>\n\n\n\n

version: 2\njobs:\n build:\n   machine: true\n   steps:\n     - checkout \n\n     # build image\n     - run: |         \n         docker info\n         docker build -t aspnetapp -f Dockerfile .\n     # deploy the image\n     - run: |         \n         docker login --username=$HEROKU_USERNAME --password=$HEROKU_API_KEY registry.heroku.com\n         docker tag aspnetapp registry.heroku.com\/$HEROKU_APP_NAME\/web\n         docker push registry.heroku.com\/$HEROKU_APP_NAME\/web                \n         curl https:\/\/cli-assets.heroku.com\/install.sh | sh\n         heroku container:release web -a $HEROKU_APP_NAME<\/code><\/pre>\n\n\n\n

de\u011ferleri ile yaz\u0131ld\u0131ktan sonra github ile pushlay\u0131p heroku uygulamas\u0131 ve circleci projesi olu\u015fturuyoruz.<\/p>\n\n\n\n

CircleiCI projesi olu\u015fturuken resimdeki gibi uyguluyoruz.<\/p>\n\n\n\n

\"\"\/<\/figure>\n\n\n\n
\"\"\/<\/figure>\n\n\n\n

Bulid i\u015flemlemine ba\u015flayacakt\u0131r fakat hata verecektir.<\/p>\n\n\n\n

Hatan\u0131n \u00e7\u00f6zmek ve heroku ile siteyi yay\u0131nlanmas\u0131 i\u00e7in “Project Settings” -> “Environment Variables” yolunu takip ederek a\u015fa\u011f\u0131daki de\u011fi\u015fkenler eklenir.<\/p>\n\n\n\n

HEROKU_APP_NAME :Heroku \u00fczerinden olu\u015fturdu\u011funuz uygulaman\u0131n ad\u0131<\/p>\n\n\n\n

HEROKU_API_KEY :https:\/\/dashboard.heroku.com\/account <\/a>adresinden (“Reveal” butonuna t\u0131klayarak) eri\u015febilirsiniz.<\/p>\n\n\n\n

HEROKU_USERNAME :Heroku kay\u0131t olurken kulland\u0131\u011f\u0131n\u0131z e-posta adresi https:\/\/dashboard.heroku.com\/account<\/a> adresinden eri\u015febilirsiniz.<\/p>\n\n\n\n

\u015eimdi tekrar build edebiliriz. Build etmek i\u00e7in sol men\u00fcden builds sekmesine gidip son fail olan builde t\u0131klay\u0131p sa\u011f \u00fcste bulunan Rerun workflow <\/strong>butonuna bas\u0131yoruz ve build i\u015flemimiz tekrar ba\u015fl\u0131yor.<\/p>\n\n\n\n

Bulid i\u015flemi ba\u015far\u0131l\u0131 ise heroku \u00fczerinden site yay\u0131nlanm\u0131\u015f olur.<\/p>\n\n\n\n

E\u011fer bu yaz\u0131yla ili\u015fkin anlatamad\u0131\u011f\u0131m\\anla\u015f\u0131lamayan konular varsa yaz\u0131n\u0131n alt\u0131na yorum yapabilirsiniz.<\/p>\n\n\n\n

\u0130yi g\u00fcnler.<\/p>\n","protected":false},"excerpt":{"rendered":"

Merhaba Muhterem Ziyaret\u00e7ilerimiz, Bu yaz\u0131mda Heroku ile .NET CORE Web uygulamas\u0131na nas\u0131l yay\u0131mlanaca\u011f\u0131n\u0131 anlatmaya \u00e7al\u0131\u015faca\u011f\u0131m. Visual Studio \u00fczerinden haz\u0131rlanm\u0131\u015fsa: “%UserProfile%\\kullaniciAdi\\source\\repos\\projeAdi\\projeAdi” klas\u00f6r\u00fcne Dockerfile ve .circlei klas\u00f6r\u00fcn\u00fc ekliyoruz.<\/p>\n","protected":false},"author":3,"featured_media":809,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[90,81,93,84,87],"tags":[101,104,105,108,226,228,230,231,232,237,238,257,289,298,328,394,439,442,444,568,814],"_links":{"self":[{"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/posts\/807"}],"collection":[{"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/comments?post=807"}],"version-history":[{"count":0,"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/posts\/807\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/media\/809"}],"wp:attachment":[{"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/media?parent=807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/categories?post=807"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/localhost\/bilisimkurdu\/wp-json\/wp\/v2\/tags?post=807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}