Skip to content

goldstarlearning/capistrano-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capistrano::Docker

Build and deploy docker images with capistrano.

Installation

Add this line to your application’s Gemfile:

gem 'capistrano-docker',
  git: "https://github.com/goldstarlearning/capistrano-docker.git"

And then execute:

bundle

Usage

Add this line to your capistrano configuration:

require "capistrano/docker"

Configuration Variables

capistrano-docker uses these variables to name docker images and containers:

set :organization, "orgname"
set :application,  "myapp"
set :branch, fetch(ENV["BRANCH"], `git rev-parse --abbrev-ref HEAD`.rstrip)

Docker images will be named/tagged as: `organization/application:branch-SHA`

Currently, the docker image is built on the primary server having the `build’ role, then copied and installed on all servers with the `app’ role. Implying a stage set-up that includes something like the following:

server ENV["APP_SERVER"],
       user: "deploy",
       roles: %w{app web}

server ENV["BUILD_SERVER"],
       user: "deploy",
       roles: %w{build},
       primary: true

Available Tasks

cd test-app && bundle exec cap -T docker
cap docker:buildBuild the docker image
cap docker:cleanClean docker image files older than :keep_images_for_days [default: 3]
cap docker:deployRun the application container
cap docker:installInstall built docker image onto application servers
cap docker:psShow running docker containers
cap docker:pullPull the latest docker build
cap docker:showList running container for deployment branch

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/goldstarlearning/capistrano-docker.

License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

About

Build and push docker containers with capistrano 3.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •