Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Added local deployment configurations to get up and running in one co…
Browse files Browse the repository at this point in the history
…mmand

Signed-off-by: Ka Hin Ng <[email protected]>
  • Loading branch information
Vladimir Kasatkin authored and Ka Hin Ng committed Apr 17, 2018
1 parent d24ed53 commit 43fb41b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ RUN /root/.rbenv/plugins/ruby-build/install.sh
ENV PATH /root/.rbenv/bin:$PATH

# Pick Ruby version
RUN rbenv install 2.3.1
RUN rbenv global 2.3.1
RUN rbenv install 2.3.1 && rbenv rehash && rbenv global 2.3.1
ENV PATH /root/.rbenv/shims:$PATH

# Install bundler
RUN /bin/bash -c 'eval "$(rbenv init -)" && gem install bundler'
RUN gem install bundler

# Install capybara dependencies
RUN apt-get install -y qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
Expand All @@ -37,4 +37,13 @@ RUN { \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server libmysqlclient-dev

# Install timezone data
RUN apt-get install -y tzdata
RUN apt-get install -y tzdata

# Install Rails
RUN gem install rails

# Rails apps run on port:3000 by default
EXPOSE 3000

# https://github.com/opsxcq/docker-vulnerable-dvwa/issues/3 mysql does not start without "touching" the /mysql files
ENTRYPOINT chown -R mysql:mysql /var/lib/mysql && service mysql start && exec /bin/bash "$@"
8 changes: 4 additions & 4 deletions concourse/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ set -ex

cd project-monitor-repo

rbenv exec bundle install
bundle install

cp config/database.yml.example config/database.yml

# https://github.com/opsxcq/docker-vulnerable-dvwa/issues/3 mysql does not start without "touching" the /mysql files
chown -R mysql:mysql /var/lib/mysql && service mysql start

RAILS_ENV=test rbenv exec rake db:create
RAILS_ENV=test rbenv exec rake db:migrate
RAILS_ENV=test rake db:create
RAILS_ENV=test rake db:migrate

xvfb-run -a rbenv exec rake spec
xvfb-run -a rake spec
22 changes: 22 additions & 0 deletions lib/tasks/local.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace :local do
desc "Create configuration files from examples"
task :copyDbConfig do
puts 'Creating config/database.yml'
system("cp config/database.yml.example config/database.yml") and puts "... done"
end

desc "Setup db"
task :setupDb => [:copyDbConfig, 'db:create','db:migrate']

desc "Start rails app"
task :startRails do
puts 'Starting rails app'
system("rails server -b 0.0.0.0 --port 3000")
end

desc "Run spec tests"
task :test => [:setupDb, :spec]

desc "Start application"
task :start => [:setupDb, :startRails]
end

0 comments on commit 43fb41b

Please sign in to comment.