Sign inSign up

jfloff/heroku-rails

By jfloff

•Updated about 6 years ago

Docker container for Rails based on Heroku-18 base image

Image
1

3.1K

jfloff/heroku-rails repository overview

⁠Heroku Rails Docker Image

Docker container for Rails based on the Heroku-18 base images.

⁠Tags available

We try to stay up-to-date with the new supported Heroku images. If you see any new one on this page⁠ feel free to open a PR!

Also there are a couple of version numbers that we have to have in sync with Heroku. Check the Dockerfile⁠ for those versions and the links where the Heroku version is kept. If you see any new version feel free to open a PR!

⁠Motivation

The Heroku base images for ruby got deprecated⁠ in favor of a more build-your-own Dockerfile strategy⁠. But I still feel that a base image for Rails serves its purposes. There is no point for each developer to replicate much of the instructions I've used here. The more automation the better amirite?

⁠Usage

The root folder for your Rails project must have a Gemfile and Gemfile.lock file. Then build a Dockerfile for your project with this image as base, and with other project-specific instructions (for example add some post-run scripts, see below):

FROM jfloff/heroku-rails:latest
# example of post-run script
RUN echo "rake db:seed" > $POST_RUN_SCRIPT_PATH/seed.sh

Then you can either run it with standard Docker docker run --rm -ti your-project or, more commonly from a Docker Compose based development $ docker-compose up web.

For more details regarding local development with docker read this Heroku article⁠

⁠Post-run script

This container comes with a post-run script⁠ that:

  • Checks and install any missing gem.
  • Precompile your assets if you are in production mode (checks $RAILS_ENV value).
  • Run your own run other post-run scripts. Just add them to /app/.post-run.d/ folder (you can also use the env varaible $POST_RUN_SCRIPT_PATH, which has the script path).

Subsequent runs will use cached changes. This is useful to avoid you from (1) having to rebuild the images each time there is a change on your Gemfile, (2) from having to run a shell just to deploy pending migrations, and (3) to precompile assets if you want to test production mode.

⁠Changelog
  • 2020/05/20: Added tag 2.6.6 with updated node. Introducing yarn binary. WARNING this change will not be made backwards, hence previous tags will not have yarn installed.
⁠License

MIT (see LICENSE file)

Tag summary

Content type

Image

Digest

Size

449.8 MB

Last updated

about 6 years ago

docker pull jfloff/heroku-rails