From 95571d63db76a882949057d711e454d19bba4b15 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 15 Nov 2017 17:53:05 +0100 Subject: [PATCH] Fixes on docker usage instructions --- Dockerfile | 3 --- Gemfile | 1 - README.md | 63 ++++++++++++++++++++++++++++++++---------------------- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index adfc146f4..af49d3a30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,6 @@ FROM coreapps/ruby2.3 # Install essential Linux packages RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs - - - # Define where our application will live inside the image ENV RAILS_ROOT /var/www/consul diff --git a/Gemfile b/Gemfile index 811cfae4f..b0c7f2e9a 100644 --- a/Gemfile +++ b/Gemfile @@ -93,5 +93,4 @@ group :development do gem 'web-console', '~> 3.3.0' end -#this is crashing with the Dockerfile eval_gemfile './Gemfile_custom' diff --git a/README.md b/README.md index 70cd5ed06..9e1a79ca6 100644 --- a/README.md +++ b/README.md @@ -80,51 +80,62 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) ## Working with Docker -Prerequisites -------------- +### Prerequisites You should have installed Docker and Docker Compose in your machine. -Also if you are going to work with docker first replace the database.yml with the preconfigured file made it to work it +On macos just: +```bash +brew install docker +brew install docker-compose +``` - cp config/database-docker.yml.example config/database.yml +### Installation +Then lets create our secrets and database config files based on examples: -The First step is to build the container +```bash +cp config/secrets.yml.example config/secrets.yml +cp config/database-docker.yml.example config/database.yml +``` - sudo docker build -t consul . - Then run - +Then you'll have to build the container with: +```bash +sudo docker build -t consul . +``` - sudo docker-compose up -d database - to create your application and database images. +Create your app database images: -Once built you can initialize your development DB and populate it with +```bash +sudo docker-compose up -d database +``` - sudo docker-compose run app rake db:create - sudo docker-compose run app rake db:migrate - sudo docker-compose run app rake db:seed - sudo docker-compose run app rake db:dev_seed +Once built you can initialize your development DB and populate it with: +``` +sudo docker-compose run app rake db:create +sudo docker-compose run app rake db:migrate +sudo docker-compose run app rake db:seed +sudo docker-compose run app rake db:dev_seed +``` -If you want to run the rails console just run in another terminal: +### Running local CONSUL with Docker +Now we can finally run the application with: +```bash +sudo docker-compose up +``` - `sudo docker-compose run app rails console` - +And you'll be able to acces it at your browser visiting [http://localhost:3000](http://localhost:3000) -Now we can finally run the application with +Additionally, if you want to run the rails console just run in another terminal: - - sudo docker-compose up +```bash +sudo docker-compose run app rails console +``` To verify the containers are up execute **sudo docker ps .** You should see output similar to this: ![enter image description here](https://i.imgur.com/ASvzXrd.png) -now you can enter to localhost:3000 - -to verify that CONSUL is running - -![enter image description here](https://i.imgur.com/Fl3XOIg.png)