Sha256: 47d68cf6a08c3ba316a07a74d80380f3786f9a3afacbd0fbc3f8b8f54d3e2107
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true # Capistrano plugin hook to set default values namespace :load do task :defaults do set :docker_prune_use_hooks, fetch(:docker_prune_use_hooks, true) set :docker_hub_use_hooks, fetch(:docker_hub_use_hooks, true) end end # Integrate hooks into Capistrano namespace :deploy do before :starting, :add_docker_hooks do invoke 'docker:add_prune_hooks' if fetch(:docker_prune_use_hooks) invoke 'docker:add_hub_hooks' if fetch(:docker_hub_use_hooks) end end namespace :docker do task :add_prune_hooks do # Cleaning up docker on start so that images/logs are available for troubleshooting. after 'deploy:starting', 'docker:prune' end task :add_hub_hooks do after 'deploy:starting', 'docker:login' after 'deploy:finishing', 'docker:logout' end desc 'Log in to Docker Hub' task :login do on roles(:app) do execute(:docker, 'login', '-u', '$DOCKER_USERNAME', '-p', '$DOCKER_PASSWORD') end end desc 'Log out of Docker Hub' task :logout do on roles(:app) do execute(:docker, 'logout') end end desc 'Prune unused images/containers' task :prune do on roles(:app) do execute(:docker, 'system', 'prune', '-af') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dlss-capistrano-docker-1.0.0 | lib/dlss/docker/capistrano/tasks/docker.rake |