Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rails project should run bundle before build image #3024
In section "Build the project", if use "--skip-bundle" when create project,
My opinion is do not use "--skip-bundle" when create project:
docker-compose run web rails new . --force --database=postgresql
docker-compose run web bundle
Then rebuild image:
@chloerei I've run through this quickstart again both ways, from a clean project directory with no other containers or images present at the start of each test:
Both work, and in both cases there is content in
I did see some clarifications I should add about taking the app down, and finding the web page on Docker for Mac and Windows, so I'll make those changes and link them to this issue, but I don't think the we need to remove
Also, the sample works with Compose v.3, so I'll update the example Compose file in the docs.
My test output
For reference, here are results of the first most relevant steps, following the procedure as written, which includes
Create the files per the steps at define the project in the Quickstart: Compose and Rails.
Check Gemfile.lock to show that it is really empty before we start
Build the project
Run docker-compose run web rails new . --force --database=postgresql --skip-bundle
From here continue with docker-compose build and rest of steps
I found the Gemfile.lock content in your post only have one denpendencies:
That is base on the initial Gemfile, not create by
But the content in Gemfile.lock is not match the Gemfile generate by
Until we run any rails command in container, like
This behavior is Implicit, and will cause problems in some situations. For example, edit Gemfile, build image, but not run any rails command in container, the Gemfile.lock will not update. Build image on other machine with same source code, it maybe not install same version gems because Gemfile.lock is outdate, and bundle resolve dependencies again.
So I recommend
Okay @chloerei that makes sense, you are right. When I re-ran that command and left off
I'm also making changes to this to run it with
If I understand correctly, then, we'll start with this (leaving off
At the end, when we are explaining steps for edit and rebuild, run:
Then, after that,
I believe the example uses mounts, so you don't actually need to rebuild, unless the mounts aren't working for some reason.
You can use
I don't think it's strictly necessary to rebuild, but I guess we could add it, if we explain what it's done.
To clarify, I say:
Do not mean