module Docker::Rails

Public Instance Methods

add_default_instructions_to(server, path) click to toggle source
# File lib/docker/rails.rb, line 34
def add_default_instructions_to(server, path)
  path = Docker::PATH(path)
  server.add_removal_instructions do |container|
    # Give all users Read/Write Access to App
    Docker.run(
      "#{rails_image(path.name)}", 
      "--rm -v #{path}:/usr/src/app",
      "chmod -R a+rw /usr/src/app"
    )
    # Remove the tmp dir files and sub directories
    `rm -rf #{path}/tmp/*`
  end
end
build(app_path) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/docker/rails.rb, line 13
def postgres
  Docker::Postgres.run('db')
end
run(app_path, options = "", command = "") click to toggle source
# 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, options = "") click to toggle source
# File lib/docker/rails.rb, line 29
def run_console(app_path, options = "")
  path = Docker::PATH(app_path)
  Docker::Rails::Console.run(path, postgres, options)
end
run_server(app_path, options = "") click to toggle source
# File lib/docker/rails.rb, line 24
def run_server(app_path, options = "")
  path = Docker::PATH(app_path)
  Docker::Rails::Server.run(path, postgres, options)
end