Class: Kuby::Docker::WebserverPhase::Puma

Inherits:
Object
  • Object
show all
Defined in:
lib/kuby/docker/webserver_phase.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phase) ⇒ Puma

Returns a new instance of Puma.



7
8
9
# File 'lib/kuby/docker/webserver_phase.rb', line 7

def initialize(phase)
  @phase = phase
end

Instance Attribute Details

#phaseObject (readonly)

Returns the value of attribute phase.



5
6
7
# File 'lib/kuby/docker/webserver_phase.rb', line 5

def phase
  @phase
end

Instance Method Details

#apply_to(dockerfile) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/kuby/docker/webserver_phase.rb', line 11

def apply_to(dockerfile)
  dockerfile.cmd(
    'puma',
    '--workers', '4',
    '--bind', 'tcp://0.0.0.0',
    '--port', phase.port,
    '--pidfile', './server.pid',
    './config.ru'
  )

  dockerfile.expose(phase.port)
end