How to release app to heroku with docker? - node.js

I've an application NodeJS and I would like to run it on Heroku.
I use the docker CLI with these command :
docker build -t registry.heroku.com/my-app/web .
docker login --username=_ --password=MYTOKEN registry.heroku.com
docker push registry.heroku.com/my-app/web
All of these commands are running good but my app is not released on heroku.
What is wrong ? Why my app is not released on heroku ?
I cannot use the heroku CLI.

The Heroku Container Runtime won't release images on docker push. That action is required, but only to upload images on the Heroku Platform.
You need to use the heroku container:release command, or the Heroku API to release those new images on your app.
See the Heroku Documentation about releasing docker images.

Related

Azure Devops + Heroku (Docker Image) - Pipelines (general workflow)

what is the general flow of the
build-pipeline -> release-pipeline?
build-pipeline:
npm install
npm run build (builds the app)
copy files (artifact)
publish artifacts
release-pipeline?
what am i supposed to do here?
Create a new docker image? (the docker image itself also runs a build)
Do i need to create a new docker image in the previous build stage and make an artifact out of it, and then in the release-pipeline push that new image to heroku?

Getting following error while deploying to node react app to heroku

List item
I am trying to deploy a node - react app on heroku
If you are deploying your app as a node.js application you can run into this issue. Create your heroku app using the create-react-app buildpack:
https://elements.heroku.com/buildpacks/mars/create-react-app-buildpack
Hope this helps!
A 503 error code means the server cannot handle the request because it is either unresponsive or overloaded, as stated on MDN. This could be a result of incorrectly initializing the application on Heroku. Run the following in your directory from the terminal to deploy to heroku.
cd my-project
git init
heroku git:remote -a app-name
git add .
git commit -am "comment"
git push heroku master
More details about deploying a Node app to Heroku can be found here

Deploy a ASPNETAPP on a docker container to a Windows VM using Azure DevOps Server 2019

I'm currently using Azure DevOps Server 2019 (on-premise) to deploy an ASP.NET App (CI-CD).
Is it possible to deploy this app to run via a docker container to a Windows VM?
i'm currently following the examples on this link on how to run an ASP.NET App on a docker container.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-3.1
How could i do the same by utilising Azure DevOps Server 2019 to do so.
basically most of not all of the resources/guides/how-to s saw are pointing deploy to the azure cloud or docker hub.
Is it possible to deploy this app to run via a docker container to a Windows VM?
Yes it is possible, You will need to create a self-hosted agent on the Windows VM to which you deploy your app. You can just use powershell task to run docker build and docker run on the self-hosted agent without the need to upload the image to ACR/dockerhub.
Of course You can aslo upload the built image to ACR/dockerhub as #Aravind mentioned. And have a powershell task that pull the image.
The main idea is to use a powershell task to run docker command on the agent hosted on the Windows VM. You can refer to below steps.
1,create a self-hosted agent. Please check the detailed steps here.
2,create a build pipeline.
Here is an example to create a yaml pipeline.
Here is an example to create a classic UI pipelie.
3, Customize your build pipeline, Use a single powershell task to run docker build and docker run command as described in the tutorial. (You can also use docker task to build and push image to ARC/Dockerhub, and then use powershell task to pull and run the image as #Aravind mentioned.)
steps:
- powershell: |
docker build -t aspnetapp .
docker run -it --rm -p 5000:80 --name aspnetcore_sample aspnetapp
displayName: 'PowerShell Script'
Noted: please make sure docker is installed on the Windows VM(the powershell task will invoke the docker cli installed on the VM). And choose the self-hosted agent(hosted on Windows VM) to run your pipeline by choosing the agent pool where the self-hosted agent resides(the agent pool that includes the self-hosted agent is decided at the creation of the agent.)

heroku deploy docker image with github

I have a nodejs express app serving a site. I deployed it with Heroku, using buildpack/nodejs and Github. Every time i push on Github, Heroku detects the push and runs the npm start script.
The problem is that I need to pass to a Docker image containing the nodejs app. I did it and it works locally, I can run it with docker run -d -p 8000:8000 exporter and it works.
I added the docker.yml file on the root folder and pushed on Github. But heroku still runs the npm script in the package.json, ignoring the docker.yml.
Is there a way to make heroku create the container from the Dockerfile every time I push to Github?
For Heroku to understand your heroku.yml file you need a few things.
First off you need to make sure that the Dockerfile is in the root directory.
Second, you need to ensure you are building and running the docker environment.
Finally, make sure you set your heroku stack to docker.
So, given that we want to ensure the directory tree looks like this:
|-my_app
|-app_contents
|-Dockerfile
|-heroku.yml
|-etc...
And that the heroku.yml file looks something like this:
build:
docker:
web: Dockerfile
run:
web: docker run -d -p 8000:8000 exporte
and finally run this in your heroku repo:
heroku stack:set container
Then just make sure you push your changes up.
If this doesn't help. I would recommend updating your post with the following:
The file tree
The Dockerfile
The heroku.yml file
Thanks to the answer of Taylor Cochran I managed to solve the problem.
I first tried to follow this link: https://devcenter.heroku.com/articles/container-registry-and-runtime
It worked but I had to do it from the cli.
After that I removed the entire project and remade it. I followed the indications of Taylor Cochran and pushed from heroku cli. I saw it worked and I then added the github deploy. And now every time I push on Github the new Docker container is automatically built and deployed by Heroku.
NB: I changed web: docker run -d -p 8000:8000 exporter to npm start

Need to deploy Node.js docker image to AWS Elastic Beanstalk using bitbucket-pipeline

I need to deploy a Node.js docker image from dockerhub to Elastic Beanstalk. I am building the image and then pushing it to the hub.docker.com now I want to deploy the image from hub.docker.com to the AWS Elastic Beanstalk using bitbucket-pipeline. The pipline is not building the image and pushing it to hub.docker.com, I want now to deploy the image using the pipeline.
Just use the following as the top line for the bitbucket-pipeline.yml:
image: node # or whatever is the image name you built on docker hub
In the scripts section, then you need to run the docker-compose commands to build and push the image.

Resources