This is the Citizens Advice Ruby on Rails base docker image. It uses the official docker ruby image as its base.
Create a Dockerfile in your Rails app project:
FROM rails:onbuildThe Dockerfile should go into the root of your app directory.
The image contains ONBUILD triggers to include the app folder and install gems.
You can build and run the image:
$ docker build --tag rails-docker .
$ docker run --name my-rails-app rails-dockerRun the following command to update the Gemfile.lock in the root of your app directory:
$ docker run --rm -v "$PWD":/app -w /app rails-docker bundle updateTo generate a new rails project:
$ docker run -it --rm --user "$(id -u):$(id -g)" -v "$PWD":/app -w /app citizensadvice/rails new --skip-bundle app-nameThis will create a sub-directory called app-name in your current directory.
For when you need to update this image to a new Rails or Ruby version or changes to the Dockerfile script
- Create a new branch with the name of the versions used in the format
{rails version}-ruby-{ruby version}{-extra}e.g.5.2.3-ruby-2.6.3or5.2.3-ruby-2.5.5-slim - Push changes to github
- Image built by docker-hub automatically
- Create PR to
master - Merge PR after approval and delete the branch