This repository includes a Dockerfile
and a set of docker-compose
configuration examples in
order to simplify the process of setting up a development environment.
Given that you have docker
and docker-compose
installed, the process should be pretty
straighforward.
-
Select a
docker-compose
configuration file from thedocker/
directory and copy it asdocker-compose.yml
. For instance, to run the application using a PostgreSQL database:cp docker/docker-compose.development.postgresql docker-compose.yml
-
Uncomment the gem for your favorite database driver from the
Gemfile
. -
Copy the database configuration from
docker/
for your database. For instance, to use PostgreSQL:cp docker/database.postgresql.yml config/database.yml
-
Build the image:
docker-compose build
-
Now you should be able to set up the database:
docker-compose run --rm web rake db:setup
When using the mysql container, this fifth step may require that you have started the database container some seconds in advance, since the official mysql and mariadb containers need some time to initialize the system.
docker-compose up --detach db
-
(Optional) Run the testsuite to find out whether the application works.
docker-compose run --rm web xvfb-run -a rake spec
-
And, now, you can start the application:
docker-compose up
For now on, you will need to rebuild the image whenever you change the Gemfile
or Gemfile.lock
files.