-
Notifications
You must be signed in to change notification settings - Fork 14
/
Rakefile
59 lines (47 loc) · 1.47 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require "bundler/gem_tasks"
require "rake/testtask"
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new
rescue LoadError
puts 'Install "rubocop" to enable rubocop Rake task.'
end
Rake::TestTask.new do |t|
t.libs << "lib"
t.libs << "test"
t.test_files = FileList['test/test_*.rb']
t.verbose = true
end
task default: :test
desc "Docker build image"
task :docker_build do
sh %{docker build -t sepulworld/aptly_api_test ./test/}
end
desc "Push Docker image to Docker Hub"
task :docker_push do
sh %{docker push sepulworld/aptly_api_test}
end
desc "Pull Docker image to Docker Hub"
task :docker_pull do
sh %{docker pull sepulworld/aptly_api_test}
end
desc "List Docker Aptly running containers"
task :docker_list_aptly do
sh %{docker ps --filter ancestor='sepulworld/aptly_api_test' --format="{{.ID}}"}
end
desc "Stop running Aptly Docker containers"
task :docker_stop do
sh %{docker stop $(docker ps --filter ancestor='sepulworld/aptly_api_test' --format="{{.ID}}")}
end
desc "Start Aptly Docker container on port 8082"
task :docker_run do
sh %{docker run -d -p 8082:8080 --restart=always sepulworld/aptly_api_test /bin/sh -c "aptly api serve"}
end
desc "Show running Aptly process Docker stdout logs"
task :docker_show_logs do
sh %{docker logs $(docker ps --filter ancestor='sepulworld/aptly_api_test' --format="{{.ID}}")}
end
desc "Restart Aptly docker container"
task :docker_restart => [:docker_stop, :docker_run] do
puts "Restarting docker Aptly container"
end