Deploying my Discord bots on Heroku

If you don’t have a dedicated linux server or machine, yet you still want to run your Discord bots 24/7 for free. Heroku to the rescue. It’s a free cloud platform for developers and enterprise users.

If you intend to develop/modify bots then it’s way easier to get a super cheap cloud server at DigitalOcean, Vultr or some other provider. If you only wish to run these bots for free then Heroku will do just fine.

In this tutorial I will give an easy step-by-step tutorial on how to run my Discord speech recognition bots on Heroku.


  • You need a (temporary) linux machine with sudo access, this can be a virtualbox (preferably Ubuntu 18).
  • You need to install heroku CLI (tutorial).
  • You need to install Docker (tutorial for Ubuntu 18)


heroku login -i
heroku container:login

3. Create a new app on your dashboard panel:

Image for post
Image for post

4. Give your app a unique name and set your region, finally click “create app”.

Image for post
Image for post

5. Clone the git repository of your choice and enter it:

git clone
cd DiscordSpeechBot

6. Rename the file “settings-sample.json” to “settings.json”, then provide your API credentials and save the file.

7. Now we need to build a docker image from the Dockerfile:

sudo docker build -t dockerspeechbot .

8. Use the following command to check if our “dockerspeechbot” is listed:

sudo docker images

9. (Optional) you can try running the docker image as a test:

sudo docker run -it dockerspeechbot

10. Push the docker image to heroku, this may take several minutes:

heroku container:push dockerspeechbot -a mediumherokudemo

11. Set the image to “release” state:

heroku container:release dockerspeechbot -a mediumherokudemo

12. On your Heroku dashboard click “resources” and your dyno will be there:

Image for post
Image for post

Note: it may take a minute or two before your dyno appears.

13. Click the “edit” icon of the “dockerspeechbot” dyno and enable the slider:

Image for post
Image for post

14. Finally click “confirm”.

15. On the top right go to “more” — > “view logs”:

Image for post
Image for post

Now you should see similar logs appear, where it says that “node index.js” is launching (this may take a minute to appear).

16. Now you can go to your Discord server and try it out:

Image for post
Image for post

You’ve reached the end :)
You can now repeat this process for all the other bots to create your own.

Written by

Become a rockstar programmer and try to reach genius status on codr

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store