From c4961e0facd32f4fc664cceebeb75073c0f238d2 Mon Sep 17 00:00:00 2001 From: Semyon Pupkov Date: Mon, 30 Jan 2017 14:52:38 +0500 Subject: [PATCH] chore: add docker --- .drone.yml | 30 ++++++++++++++++++++++++++ Gemfile | 6 ++++-- Makefile | 15 ------------- dip.yml | 39 ++++++++++++++++++++++++++++++++++ docker-compose.development.yml | 17 +++++++++++++++ docker-compose.drone.yml | 6 ++++++ docker-compose.yml | 11 ++++++++++ resque-integration.gemspec | 1 - spec/spec_helper.rb | 1 - 9 files changed, 107 insertions(+), 19 deletions(-) create mode 100644 .drone.yml delete mode 100644 Makefile create mode 100644 dip.yml create mode 100644 docker-compose.development.yml create mode 100644 docker-compose.drone.yml create mode 100644 docker-compose.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..19e0f4c --- /dev/null +++ b/.drone.yml @@ -0,0 +1,30 @@ +matrix: + include: + - DOCKER_RUBY_VERSION: "2.2" + RUBY_IMAGE_TAG: "2.2-4" + + - DOCKER_RUBY_VERSION: "1.9.3" + RUBY_IMAGE_TAG: "1.9.3-4" + +build: + image: abakpress/dind:2 + privileged: true + volumes: + - /home/data/drone/images:/images + - /home/data/drone/gems:/bundle + - /home/data/drone/key_cache:/ssh_keys + environment: + - COMPOSE_FILE_EXT=drone + - RAILS_ENV=test + commands: + - wrapdocker docker -v + + - if [ ! -e /images/ssh-agent.tar ]; then docker pull whilp/ssh-agent; docker save whilp/ssh-agent > /images/ssh-agent.tar; fi + - if [ ! -e /images/ruby_$RUBY_IMAGE_TAG.tar ]; then docker pull abakpress/ruby:$RUBY_IMAGE_TAG; docker save abakpress/ruby:$RUBY_IMAGE_TAG > /images/ruby_$RUBY_IMAGE_TAG.tar; fi + + - docker load -i /images/ssh-agent.tar + - docker load -i /images/ruby_$RUBY_IMAGE_TAG.tar + + - dip ssh add -T -v /ssh_keys -k /ssh_keys/id_rsa + - dip provision + - dip rspec diff --git a/Gemfile b/Gemfile index 60abaeb..9c3ff64 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,9 @@ source 'https://rubygems.org' # Specify your gem's dependencies in resque-integration.gemspec if RUBY_VERSION < '2' - gem 'json', '< 2' - gem 'rack', '< 2' + gem 'pry-debugger' +else + gem 'pry-byebug' end + gemspec diff --git a/Makefile b/Makefile deleted file mode 100644 index 9eb58aa..0000000 --- a/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -RAILS_ENV = test -BUNDLE = RAILS_ENV=${RAILS_ENV} bundle -BUNDLE_OPTIONS = -j 2 -RSPEC = rspec - -all: test - -test: bundler/install - ${BUNDLE} exec ${RSPEC} spec 2>&1 - -bundler/install: - if ! gem list bundler -i > /dev/null; then \ - gem install bundler; \ - fi - ${BUNDLE} install ${BUNDLE_OPTIONS} diff --git a/dip.yml b/dip.yml new file mode 100644 index 0000000..f3bbbf7 --- /dev/null +++ b/dip.yml @@ -0,0 +1,39 @@ +version: '1' + +environment: + DOCKER_RUBY_VERSION: 2.2 + RUBY_IMAGE_TAG: 2.2-4 + COMPOSE_FILE_EXT: development + RAILS_ENV: test + APRESS_GEMS_CREDENTIALS: "" + +compose: + files: + - docker-compose.yml + - docker-compose.${COMPOSE_FILE_EXT}.yml + +interaction: + sh: + service: app + + irb: + service: app + command: irb + + bundle: + service: app + command: bundle + + rspec: + service: app + command: bundle exec rspec + + clean: + service: app + command: rm -f Gemfile.lock + +provision: + - docker volume create --name bundler_data + + - dip bundle config --local https://gems.railsc.ru/ ${APRESS_GEMS_CREDENTIALS} + - dip bundle install diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 0000000..582e95a --- /dev/null +++ b/docker-compose.development.yml @@ -0,0 +1,17 @@ +version: '2' + +services: + app: + volumes: + - ../:/localgems + - bundler-data:/bundle + - ssh-data:/ssh:ro + +volumes: + bundler-data: + external: + name: bundler_data + + ssh-data: + external: + name: ssh_data diff --git a/docker-compose.drone.yml b/docker-compose.drone.yml new file mode 100644 index 0000000..18a4ce5 --- /dev/null +++ b/docker-compose.drone.yml @@ -0,0 +1,6 @@ +version: '2' + +services: + app: + volumes: + - /bundle:/bundle diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1029ab4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '2' + +services: + app: + image: abakpress/ruby:$RUBY_IMAGE_TAG + environment: + - BUNDLE_PATH=/bundle/$DOCKER_RUBY_VERSION + - SSH_AUTH_SOCK=/ssh/auth/sock + command: bash + volumes: + - .:/app diff --git a/resque-integration.gemspec b/resque-integration.gemspec index 2c982fd..fc8e621 100644 --- a/resque-integration.gemspec +++ b/resque-integration.gemspec @@ -39,6 +39,5 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rspec', '~> 2.14' gem.add_development_dependency 'simplecov' gem.add_development_dependency 'mock_redis' - gem.add_development_dependency 'pry-debugger' gem.add_development_dependency 'timecop' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 24e65a0..0461866 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,5 @@ # coding: utf-8 require 'bundler/setup' -require 'pry-debugger' require 'rspec' require 'resque' require 'simplecov'