From 63138aef3019346f3e150ab3e9def818915a6095 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sun, 5 Apr 2020 00:06:31 +0100 Subject: [PATCH] Re-add setup instructions removed from docker-compose into Dockerfile and Docker.md --- DOCKER.md | 11 +++++++++-- Dockerfile | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DOCKER.md b/DOCKER.md index 994f582fdee..3df0f7d3452 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -35,13 +35,20 @@ Download the Docker images and build the containers: $ docker-compose build ``` -Run the app with all the required containers: +Setup the database and seed it with sample data: +```sh +$ docker-compose run web bundle exec rake db:reset +$ docker-compose run web bundle exec rake db:test:prepare +$ docker-compose run web bundle exec rake ofn:sample_data +``` + +Finally, run the app with all the required containers: ```sh $ docker-compose up ``` -This command will setup the database and seed it with sample data. The default admin user is 'ofn@example.com' with 'ofn123' password. +The default admin user is 'ofn@example.com' with 'ofn123' password. Check the app in the browser at `http://localhost:3000`. You will then get the trace of the containers in the terminal. You can stop the containers using Ctrl-C in the terminal. diff --git a/Dockerfile b/Dockerfile index fa7718f2ee7..93caceecc1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ENV BUNDLE_PATH /bundles WORKDIR /usr/src/app COPY .ruby-version . -# Rbenv & Ruby part +# Install Rbenv & Ruby RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \ git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \ ${RBENV_ROOT}/plugins/ruby-build/install.sh && \ @@ -21,7 +21,7 @@ RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \ rbenv global $(cat .ruby-version) && \ gem install bundler --version=1.17.2 -# Postgres +# Install Postgres RUN sh -c "echo 'deb https://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main' > /etc/apt/sources.list.d/pgdg.list" && \ wget --quiet -O - https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - && \ apt-get update && \ @@ -38,4 +38,6 @@ RUN wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.z unzip chromedriver_linux64.zip -d /usr/bin && \ chmod u+x /usr/bin/chromedriver +# Copy code and install app dependencies COPY . /usr/src/app/ +RUN bundle install