-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using heroku stack images for local development #56
Comments
Hello there, When using Docker, you don't need to use the base image we provide (though you absolutely can). You can use any base image you wish. Docker allows you to set a base image in your Dockerfile with the
You can look at our Alpine Hello World app for a very simple example of a Dockerfile.
There might be a misunderstanding here. When you use your container locally, there is no Heroku involved. You just need to build the container and start it, like any other Docker one. Note that the big difference between deploying with our container registry and the standard way of using GIT push, GitHub Sync or our API is that the later will allow us to upgrade base libraries such as OpenSSL without the need for a new deployment from you. So while we update base packages when there are security issues, we can't do that for docker containers which means that works falls back to you. |
Thank you, that clarifies it a bit. So if I get that right that means that, even if I use the Ideally, I wanted to use the exact same environment as heroku uses in production. e.g.: Do I get that right, or is there a simpler way to reproduce the production environment locally? P.S.: note I don't mean to deploy Docker to heroku. Rather the opposite: I'm using Docker locally only, to try and reproduce the heroku environment locally. |
That's correct. What would be awesome would be a variant of |
Though doing so would be hacky (or slow), since the Dockerfile would have no way of knowing which files the buildpacks required (eg |
Ed is absolutely right. Your local environment would need to mimick the execution of the buildpack, which would be tricky today. |
Thanks a lot, it's a lot clearer now. There's gonna be a lot of variability of course, but I'll ask anyway: what do people usually go for in terms of local development workflow then? Would you recommend:
Sorry for the many questions. I was able to find a lot of doc in terms of deploying to Heroku, but not so much in terms of best practices for local development. |
Some people run the buildpacks in the container (it's possible, the api is public). Even using docker will not be exactly the same thing as on our platform though. You will have the same versions, but we block sudo access and allow only storing files in For most apps, the abstraction level allows them to run the app locally, with the development environment provided by their machine. The other production similarity you won't be able to achieve easily and which reinforces that idea of not trying to mimick production at 100% locally is that our router will proxy requests to your app, while with docker you will call it directly. |
So I've gotten pretty far by creating a dockerfile that looks like this:
One difficulty I've encountered is that nokogiri wants |
The list of packages in each are here: (gcc comes along with the build-essential package) |
Once I did that it worked! Now my blocker is that once I create a container around this build none of the gems exist (including bundler). EDIT: This might have to do with some fuckery I tried with --deployment. |
If you take a look in $APPLICATION/.profile.d, you'll find a number of scripts created by the buildpack. You'll likely have to |
So the only thing I have to figure out now is how to source right path changes. Has anyone done this in an automated way? If not, I think all I need to do is create & |
Oh, and the other thing is that the current nodejs buildpack creates a
What am I supposed to do about that? |
It might be worth creating a user during RUN useradd --home-dir /app app
USER app should do it. It may also be worth chowning |
I'm closing this issue due to inactivity and as it doesn't seem there's an action for us to take. Please reopen if I'm mistaken. |
If it helps for anyone else who comes across this issue looking for how to replicate heroku's dual-image pattern using Docker multi-stage builds... the following is what
|
Anyone know how to get the above working with jruby? The download timeouts, but the link seems to work fine when I click it manually. |
I grabbed the latest multi-stage build steps for ruby like this: Generate a rails app
Add heroku.yml
Commit changesCreate heroku app and deploy (watch output for commands)
Output
|
As I'm finally becoming a decent software engineer, I'm able to contribute back to the community. I have made significant improvements to the performance of using Heroku's stacks locally. Well almost. This is almost done, but I can't get the profile.d files to properly source. First, make sure to set these in your shell config.
Dockerfile
|
Hi,
I'd like to run heroku locally to ease development, i.e.: so as to have the same environment for dev as heroku provides for staging and prod.
I'd like to use the heroku Docker images for that. This way, I wouldn't have to install every requirement manually in OS X, and would be able to juggle between different versions with the same ease as on heroku.
It's not clear yet how I can use those images.
I was able to pull the image with
docker pull heroku/heroku:16
, then start it withdocker run -i -t heroku/heroku:16 /bin/bash
.However, I'm a bit confused as to what to do next. Could you provide some guidelines? e.g.:
How do I (Can I?) configure heroku to deploy locally to the local Docker heroku container, instead of the staging or production environments?
The text was updated successfully, but these errors were encountered: