Skip to content

Instantly share code, notes, and snippets.

@lmars
Last active August 29, 2015 13:55
Show Gist options
  • Save lmars/8708967 to your computer and use it in GitHub Desktop.
Save lmars/8708967 to your computer and use it in GitHub Desktop.
Docker Deployer
class Deployer
attr_accessor :current_id
attr_reader :image
def initalize(image)
@image = image
end
def start
self.current_id = run "docker run #{image}"
end
def stop
run "docker stop #{current_id}"
end
def pull
run "docker pull #{image}"
end
def deploy
pull
stop
start
end
end
deployer = Deployer.new("lmars/app")
deployer.start
trap("USR2") { deployer.deploy }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment