/rails-docker

A repo with boilerplate code for creating Rails / Docker apps

Primary LanguageShell

rails-docker

This repo contains the boilerplate code required to initialise a Rails app using Docker.

In order for this to be of any use, you will need to have the following installed on your machine:

Clone this repo

First clone the repo (replacing YOUR_APP_NAME with the name of your app), and remove the git history.

git clone git@github.com:gtm19/rails-docker.git YOUR_APP_NAME
cd YOUR_APP_NAME

Creating a new app

The following will create a boilerplate Rails app, with simpleform, bootstrap, and devise all locked and loaded by default.

./init.sh

Rails Templates

You can (optionally) provide a different template as follows:

./init.sh --template minimal_docker

The only options at the moment are:

  • minimal_docker
  • devise_docker (default)

See here for the source.

App name

You can optionally choose a name for your app by adding it as an unflagged argument.

By default, it will use the name of the working directory from where ./init.sh is called.

./init.sh my-way-cool-app

Rebuilding the image(s)

Changes to either the Gemfile or the Dockerfile will require a rebuild. This includes the changes which are caused by creating a new app.

docker-compose build

Running the app

docker compose up

Rebuilding the app

If you make changes to the Gemfile or the Compose file to try out some different configurations, you need to rebuild.

Some changes require only

docker compose up --build

...but a full rebuild requires:

docker compose run web bundle install
docker compose up --build

Stopping the app

docker compose down