kawasin73 / rails_docker_template

Docker template for Rails app or Rails + Webpacker app development.
80 stars 34 forks source link
docker rails template webpacker

docker rails template

Docker template for Rails app or Rails + Webpacker app development.

Use for development

This template use entrykit to execute bundle install on ENTRYPOINT of Docker.

No re-build docker image on changing Gemfile because bundled gems is cached in Docker Volume.

To develop rails app, use following commands.

script/bootstrap
docker-compose exec rails bash

You can execute any commands in docker container.

Getting started

You can build rails app from template like this.

git clone https://github.com/kawasin73/rails_docker_template.git .
git checkout origin/base/ruby-2.5.1-rails-5.2.0
git branch -d master && git checkout -b master
script/init && script/bootstrap

docker-compose up -d
docker-compose exec rails bash
# access to http://localhost:3000

You can also use built app like this.

git clone https://github.com/kawasin73/rails_docker_template.git .
git checkout origin/ruby-2.5.1-rails-5.2.0
git branch -d master && git checkout -b master
script/bootstrap
# initialize credentials.yml.enc
docker-compose run --rm rails bin/rails credentials:edit

docker-compose up -d
docker-compose exec rails bash
# access to http://localhost:3000

Branches

This repository have 4 types of branch, master, webpacker, base, built. If you want start development, Use built branch.

base branch

base/ruby-RUBY_VERSION-rails-RAILS_VERSION branch has only template. base branch have one Initial Commit commit.

Please build application on your local environment.

git clone https://github.com/kawasin73/rails_docker_template.git .
git checkout origin/base/ruby-2.5.1-rails-5.2.0
git branch -d master && git checkout -b master
script/init && script/bootstrap

built branch

ruby-RUBY_VERSION-rails-RAILS_VERSION branch has built application.

Please initialize secrets and start to development.

git clone https://github.com/kawasin73/rails_docker_template.git .
git checkout origin/ruby-2.5.1-rails-5.2.0
git branch -d master && git checkout -b master
script/bootstrap
# initialize credentials.yml.enc
docker-compose run --rm rails bin/rails credentials:edit

License

MIT