forked from o19s/quepid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker
executable file
·28 lines (25 loc) · 887 Bytes
/
docker
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
#!/usr/bin/env ruby
require 'pathname'
require 'shellwords'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
command, *rest = ARGV
Dir.chdir APP_ROOT do
case command
when 'server', 's'
system 'docker-compose up --no-deps -d nginx'
system 'docker-compose run --rm --service-ports app foreman s -f Procfile.dev'
when 'bash', 'b'
system 'docker-compose run --rm app bash'
when 'console', 'c'
system 'docker-compose run --rm app rails console ' # add -e test for test environment
when 'run', 'r'
system "docker-compose run --rm app #{rest.shelljoin()}"
when 'daemon', 'q'
system 'docker-compose run -d --service-ports app foreman s -f Procfile.dev'
when 'destroy', 'd'
system 'docker-compose down'
else
puts 'Unknown option (bash|b, console|c, run|r, server|s, daemon|q, destroy|d)'
end
end