7

I am trying to find a way to set the stack to 'container' so I can deploy my app in a docker image rather than heroku-18. Reasons for this are complicated, but necessary.

The Heroku Docker image setup docs say I can do this in my app.json file, like so:

"stack": "container"

but doing this causes an error when deploying through the online interface:

 !     No default language could be detected for this app.
            HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
            See https://devcenter.heroku.com/articles/buildpacks
 !     Push failed

Are there other ways to set the stack to container? For e.g., according to these docs it may also be possible to set this using the Dockerfile, but it's not clear exactly how to do this.

I know I can use the heroku CLI, but I'd prefer to set this up in my git repo as this app will be deployed to other users also.

Thanks in advance for any advice!

Firas
  • 516
  • 5
  • 10

3 Answers3

15

Just need to run this command

$ heroku stack:set heroku-18 --app HEROKU_APP_NAME

or any stack you need

# $ heroku stack:set <heroku-stack> --app HEROKU_APP_NAME
$ heroku stack:set heroku-22 --app HEROKU_APP_NAME
robert.batty
  • 490
  • 5
  • 13
  • 1
    Thanks! I think this is what I was looking for! – Firas Jun 02 '21 at 05:52
  • Ahh now I remember. I thought this is what I was looking for, but I remembered I needed to do it without the CLI, but I found a workaround anyway. – Firas Jun 02 '21 at 13:54
2

To set the stack to container using the command line (as an alternative to editing app.json), I believe

heroku stack:set container

will do the trick. You can read more about deploying containers on Heroku here (see Step 3 of Getting Started for the syntax above):

https://devcenter.heroku.com/articles/build-docker-images-heroku-yml

rpkyle
  • 36
  • 2
0

I also faced the same issue.

The app.json specification of "stack: container" method works, when you create a "deploy to Heroku" button. (a gui way) docs

https://heroku.com/deploy?template=https://github.com/user/repo clicking this link will work. the building will be sucessful.

But it does not work if you follow the below approach:

  • create a new app from heroku dashboard
  • go to the deploy tab

image

  • connect to the github repository image
  • and click deploy image
aahnik
  • 1,661
  • 1
  • 11
  • 29