Skip to content
This repository has been archived by the owner. It is now read-only.

Conversation

JohnMorales
Copy link

As it stands the container will include the source code ver when the onbuild image was built. Not when the container was run.

By simply adding an entrypoint script, and moving the bundle install to entrypoint, along with the ability to run db migrate db setup, the container is able to be run with the usr/src/app mounted as a volume. This allows the container to be rerun with the latest changes to your app included.

i.e. docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app your_onbuild_image will just work™

@yosifkit
Copy link
Member

As nice as this could be for some setups, this could really slow down other developers since every restart of the container will cause a new bundle install since they are not already there. I think there is a case for having both a bundle install in the Dockerfile and one in an entrypoint script so that slight dependency changes can be tested quickly without a full image build, but that is not the general case. For production or QA, a user would want the deps in the image, not installed to the container at startup.

Perhaps we just need extra documentation to show how to do a more advanced setup with a script and apt installs instead of just using FROM rails:onbuild.

Any thought @tianon or @Moghedrin?

@tianon
Copy link
Member

tianon commented Mar 10, 2015

Yeah, I agree; +1 for adding more documentation for making this kind of stuff easier / more obvious.

@JohnMorales
Copy link
Author

@yosifkit that makes sense, in hind sight there is no reason why I made the location of the bundle install mutually exclusive. We could leave it as it was, but add the option to also run bundle install in the entrypoint. that way the docker image will be preloaded with some gems, but any new gems that you need if you were to mount a newer app dir will get installed at run.

@tianon
Copy link
Member

tianon commented Mar 11, 2015

I'm generally a fan of the pattern of bundle install in the Dockerfile and then bundle install and rake tasks in the entrypoint (and find that it works well), but I still think it's way too specific to actually build an entrypoint into the image by default. Even rake db:setup, while common, isn't 100% standard, and I've found that most projects inevitably need "more stuff" in their entrypoint too, so I'd much rather we document a good pattern for doing this.

@tianon
Copy link
Member

tianon commented Aug 19, 2016

Given that the recommended usage for Rails itself is to add it to your project's Gemfile and use bundle to install it, the rails official image has been deprecated as of Jul 5 in favor of using the ruby image directly (see docker-library/docs#503 for more details).

Sorry for the inconvenience! Since the image will not be receiving anything besides minor maintenance updates (version bumps for example), we're closing out old issues accordingly. Thanks!

@tianon tianon closed this Aug 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants