class DockerDeploy::Stage

Attributes

container[R]
deploy[R]
env_files[R]
name[R]
servers[R]
services[R]
variables[R]

Public Class Methods

new(context, name) click to toggle source
# File lib/docker_deploy/stage.rb, line 7
def initialize(context, name)
  @context = context
  @name = name
  @env_files = []
  @services = []
  @variables = {}
  @ports = {}
  @links = {}
  @deploy = ["docker:build", "docker:push", :pull, :restart]
end

Public Instance Methods

env(variables = {}) click to toggle source
# File lib/docker_deploy/stage.rb, line 18
def env(variables = {})
  @variables.merge!(variables)
end
env_file(env_file) click to toggle source
# File lib/docker_deploy/stage.rb, line 30
def env_file(env_file)
  @env_files.push(env_file)
end
host(name = nil) click to toggle source
# File lib/docker_deploy/stage.rb, line 34
def host(name = nil)
  @host = name if name
  @host
end
options() click to toggle source
# File lib/docker_deploy/stage.rb, line 47
def options
  DockerDeploy.format_params("--env-file %s", @context.env_files + @env_files) + " " +
  DockerDeploy.format_params("-e %s=%s", @context.variables.merge(@variables))
end
port(ports = {}) click to toggle source
# File lib/docker_deploy/stage.rb, line 22
def port(ports = {})
  @ports.merge!(ports)
end
port_mappings() click to toggle source
# File lib/docker_deploy/stage.rb, line 43
def port_mappings
  DockerDeploy.format_params("-p %s:%s", @context.ports.merge(@ports))
end
service(name, &block) click to toggle source
# File lib/docker_deploy/stage.rb, line 57
def service(name, &block)
  service = Service.new(self, name)
  service.instance_eval(&block)
  @services << service
end