docker-manager 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 581446b2a09ddf1967361de58cb24613bdc001c73d227f363859dc5ddcbab952
4
- data.tar.gz: 0b48dfbfb858e415c0804518fc7fc9c6e896e22560a47d546cd0a41773234c92
3
+ metadata.gz: b7e2061cbcba047b1b603894173393b04ab85415daa20c0f77a3fba92502e891
4
+ data.tar.gz: 3e2f7c11d8951931c6cf11161a285284086a24915841ab4ade89d3872eb2ad75
5
5
  SHA512:
6
- metadata.gz: 8d5edbe422e5aeb2636ce3e5a9f3e16ec11c172072b82a1d3f43165c34fde456a634f084fcc33be153964fdc81d0b5f1e4ef9fe9663a81ac9afbb9ae22c76e16
7
- data.tar.gz: fac05bf6a892e20316cc7f9c402b52273808f5983b4d32eb55e89fa30ca581eb413b8b691d036358c0ca87582b461a14a3c2490d04b005e83f77ea38e38a87d1
6
+ metadata.gz: a8ac19f076722b81497937c48497717a16ac56a99f5c5b4f2dc4587a9962438e54d94c194e2f5d55db7b5e75664f2717f82b3a6c44e7fa63125654c70c5a541f
7
+ data.tar.gz: 2c3e3818091f94a8605ac6e49caa37ad7ebea9955e6542b77f98644de0445529cc1a63650d3f309faef52bf693dfaada52ccb131a8843c798b8a5df99e102718
@@ -4,21 +4,25 @@ module DockerManager
4
4
  def run
5
5
  # to avoid scope issue
6
6
  env = config.env
7
+ local_git_tmp_path = config.local_git_tmp_path
7
8
  project_root_path = config.project_root_path
8
9
  local_docker_path = config.local_docker_path
9
10
  local_deploy_path = config.local_deploy_path
10
11
  registry_login = config.registry_login
11
12
  registry_password = config.registry_password
12
13
  registry_server = config.registry_server
14
+ env_git_branch = config.env_git_branch
13
15
  env_remote_directory = config.env_remote_directory
14
16
  containers_to_restart = (config.containers_to_restart || []).join(' ')
15
17
  run_locally do
18
+ execute("rm -fr #{local_git_tmp_path} && mkdir #{local_git_tmp_path}")
19
+ execute("git clone -b #{env_git_branch} #{git_repository} #{local_deploy_path}")
20
+ execute("cp #{local_deploy_path}/#{env}/.env #{local_git_tmp_path}/.env")
21
+ execute("cp #{local_docker_path}/docker-compose.server.yml #{local_git_tmp_path}")
16
22
  # within doesn't work
17
- execute("cd #{project_root_path} && ln -sf #{local_deploy_path}/#{env}/.env .env")
18
- execute("cd #{project_root_path} && ln -sf #{local_docker_path}/docker-compose.server.yml docker-compose.server.yml")
19
- execute("cd #{project_root_path} && docker-compose -f docker-compose.server.yml build")
20
- execute("cd #{project_root_path} && docker login -u #{registry_login} -p '#{registry_password}' #{registry_server}")
21
- execute("cd #{project_root_path} && docker-compose -f docker-compose.server.yml push")
23
+ execute("cd #{local_git_tmp_path} && TAG=#{env_git_branch} docker-compose -f docker-compose.server.yml build")
24
+ execute("cd #{local_git_tmp_path} && docker login -u #{registry_login} -p '#{registry_password}' #{registry_server}")
25
+ execute("cd #{local_git_tmp_path} && docker-compose -f docker-compose.server.yml push")
22
26
  end
23
27
  on config.env_host do
24
28
  execute(:mkdir, "-p", "#{env_remote_directory}/data")
@@ -2,13 +2,13 @@ module DockerManager
2
2
  class Config
3
3
  KEYS = {
4
4
  env: {
5
- required: %i[host docker_user remote_directory remote_postgres_db_container local_postgres_db_container]
5
+ required: %i[host docker_user remote_directory remote_postgres_db_container local_postgres_db_container git_branch]
6
6
  },
7
7
  registry: {
8
8
  required: %i[login password],
9
9
  optional: %i[server]
10
10
  },
11
- required: [],
11
+ required: %i[git_repository],
12
12
  optional: %i[containers_to_restart]
13
13
  }
14
14
 
@@ -52,6 +52,10 @@ module DockerManager
52
52
  @local_deploy_path
53
53
  end
54
54
 
55
+ def local_git_tmp_path
56
+ @local_git_tmp_path ||= "#{local_deploy_path}/tmp"
57
+ end
58
+
55
59
  KEYS.keys.each do |parent_key|
56
60
  case parent_key
57
61
  when :required, :optional
@@ -1,3 +1,3 @@
1
1
  module DockerManager
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Biard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2019-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sshkit