Module: Docker::Rails
- Extended by:
- Docker, Helpers, Rails
- Included in:
- Rails
- Defined in:
- lib/docker/rails.rb,
lib/docker/rails/server.rb,
lib/docker/rails/console.rb
Defined Under Namespace
Classes: Console, Server
Constant Summary
Constants included
from Docker
USER_NAME
Instance Method Summary
collapse
Methods included from Helpers
rails_image, rails_server
Methods included from Docker
ID, PATH, all_containers, containers, find_container, find_containers, images, inspekt
Instance Method Details
#add_default_instructions_to(server, path) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/docker/rails.rb', line 34
def add_default_instructions_to(server, path)
path = Docker::PATH(path)
server.add_removal_instructions do |container|
Docker.run(
"#{rails_image(path.name)}",
"--rm -v #{path}:/usr/src/app",
"chmod -R a+rw /usr/src/app"
)
`rm -rf #{path}/tmp/*`
end
end
|
#build(app_path) ⇒ Object
8
9
10
11
|
# File 'lib/docker/rails.rb', line 8
def build(app_path)
path = Docker::PATH(app_path)
Image.build(path, "rails-#{path.name}")
end
|
#find_server(path) ⇒ Object
48
49
50
51
52
|
# File 'lib/docker/rails.rb', line 48
def find_server(path)
path = Docker::PATH(path)
server = Docker.find_container(name: rails_server(path.name))
Rails::Server.load(server.id, path) if server
end
|
#postgres ⇒ Object
13
14
15
|
# File 'lib/docker/rails.rb', line 13
def postgres
Docker::Postgres.run('db')
end
|
#run(app_path, options = "", command = "") ⇒ Object
17
18
19
20
21
22
|
# File 'lib/docker/rails.rb', line 17
def run(app_path, options = "", command = "")
path = Docker::PATH(app_path)
image = rails_image(path.name)
options = "#{options} -v #{path}:/usr/src/app"
Docker::Container.run(image, options, command, path)
end
|
#run_console(app_path) ⇒ Object
29
30
31
32
|
# File 'lib/docker/rails.rb', line 29
def run_console(app_path)
path = Docker::PATH(app_path)
Docker::Rails::Console.run(path, postgres)
end
|
#run_server(app_path) ⇒ Object
24
25
26
27
|
# File 'lib/docker/rails.rb', line 24
def run_server(app_path)
path = Docker::PATH(app_path)
Docker::Rails::Server.run(path, postgres)
end
|