Skip to main content

Publishing net core app on Heroku


You know that there are no much .Net hosting, so for testing porpuse is somethimes hard to find a way to preview your project.
This how to publish a .Net core app(also .Net applications, like mvc, etc) on Heroku

Requirements.

* an Account on Heroku(and download heroku-cli)
* A few knowledge of Docker(this is the approach to publish) download docker-tools for windows
* your .Net Core app(create a empty project .net core api if you don't have one)

Steps:

Create a Docker file at solution/project level:
content:
  
FROM microsoft/aspnetcore:2.0.5
WORKDIR /app
COPY . .
CMD ASPNETCORE_URLS=http://*:$PORT dotnet coolbox.sale.api.dll
Compile your project as Release

on cmd go to your publish folder(usually: bin/Release/netcoreapp2.0/publish)
execute this steps

1. Login on heroku
    heroku login


2. login in container
    heroku container:login


3. publish api or
    dotnet publish -c Release

4. Copy DOCKERFILE to publish directory
    ./bin/release/netcoreapp2.0/publish


    **In publish directory**


5. build docker image
    docker build -t coolboxsale-api .


6. tag the heroku target image
    docker tag coolboxsale-api registry.heroku.com/coolboxsale-api/web


7. push changes
    heroku container:push web --app coolboxsale-api


8. put online:
    heroku container:release web --app coolboxsale-api


and voila!:



For republish

Steps 5,7,8

Popular posts from this blog

Install docker on Oracle Linux 7 Notes

Add the necessary repo to the instance: cd /etc/yum.repos.d sudo vim docker-ce.repo Add these lines on top [centos-extras] name=Centos extras - $basearch baseurl=http://mirror.centos.org/centos/7/extras/x86_64 enabled=1 gpgcheck=0 Save and run the following command    sudo yum -y update  This will prevent: ---> Package docker-scan-plugin.x86_64 0:0.8.0-3.el7 will be installed ---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed ---> Package libseccomp.x86_64 0:2.3.1-4.el7 will be installed --> Finished Dependency Resolution Error: Package: 3:docker-ce-20.10.8-3.el7.x86_64 (docker-ce-stable)            Requires: container-selinux >= 2:2.74 Error: Package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64 (docker-ce-stable)            Requires: fuse-overlayfs >= 0.7 Error: Package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64 (docker-ce-stable)            Requ...

Getting Team Foundation Server Free Online

VisualStudio has release TFS their service, so using your Microsoft account you could get that service. Steps: go to https://www.visualstudio.com/ LogIn and click on your accout name

Driver antes de formatear

Se te perdieron los drivers?? y no los encuentras y seguro desearias no haberlo formateado tu PC, pues para no estar teniendo que lidiar con estos problemas solo tenermos que instalar un programa, se llama Driver Genius, este programa lo que haces es recuperar todos tus drivers de tu PC, este te lo puede comprimir, crear un carpeta o crear un ejecutable(particularmente me gusta) y asi cuando lo formateaste pues solo tienes que hacer click en el ejecutable :) asi de facil, ya no estaras reiniciando cada vez sino una solo vez, y todo lindo anda todo bien con tus drivers El programa te lo puedes bajar aqui Driver Genius version trial. Ademas asi haces un Backup de tus driver, suerte