Sha256: 0cce37eccc953b7797a3556ee0300e4c33c1eb232ca0257061a80007925144d2

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

def printimages
  puts %x[docker images | grep '^gild/gaptool']
end

unless File.exists?('/.dockerenv')
  namespace :docker do
    namespace :build do
      task :image do
        sys(%w(./scripts/build_docker_images.sh))
        printimages
      end

      task :all => [:image]
    end

    desc 'Build the docker image'
    task :build => 'build:image'

    desc "Push the release image to the Docker Hub"
    task :push => 'push:release'

    task :up => [:build, :recreate]

    desc "Run tests w/ docker"
    task :test => :build do
      sys(%w(docker-compose run --rm gaptool bundle exec rake test))
    end

    desc "Stop docker containers"
    task :stop do
      sys(%w(docker-compose stop))
    end

    desc "Start docker containers"
    task :start do
      sys(%w(docker-compose start))
    end

    desc "Restart docker containers"
    task :restart => [:stop, :start]

    desc "Stop and remove docker containers (alias 'rm')"
    task :remove => :stop do
      sys(%w(docker-compose rm --force))
    end

    task :rm => :remove

    desc "Recreate docker containers without building"
    task :recreate do
      sys(%w(docker-compose up -d))
    end

    desc "Run a command in the docker container"
    task :run do
      exit sys(%W(docker-compose run --rm gaptool #{ARGV[1..-1].shelljoin}))
    end
  end

  desc "Bring up docker containers"
  task :docker => 'docker:up'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gaptool-server-0.7.1 tasks/docker.rb