kitchen-docker 0.1.0.dev → 0.1.1.dev

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.
@@ -29,6 +29,7 @@ module Kitchen
29
29
  class Docker < Kitchen::Driver::SSHBase
30
30
 
31
31
  default_config :image, 'ubuntu'
32
+ default_config :platform, 'ubuntu'
32
33
  default_config :port, '22'
33
34
  default_config :username, 'kitchen'
34
35
  default_config :password, 'kitchen'
@@ -50,19 +51,45 @@ module Kitchen
50
51
  protected
51
52
 
52
53
  def dockerfile
53
- path = File.join(File.dirname(__FILE__), 'docker', 'Dockerfile')
54
- File.expand_path(path)
54
+ from = "FROM #{config[:image]}"
55
+ platform = case config[:platform]
56
+ when 'debian', 'ubuntu'
57
+ <<-eos
58
+ ENV DEBIAN_FRONTEND noninteractive
59
+ RUN apt-get update
60
+ RUN apt-get install -y sudo openssh-server
61
+ eos
62
+ when 'rhel', 'centos'
63
+ <<-eos
64
+ RUN yum clean all
65
+ RUN yum install -y sudo openssh-server openssh-clients
66
+ RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
67
+ RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
68
+ eos
69
+ else
70
+ raise ActionFailed,
71
+ "Unknown platform '#{config[:platform]}'"
72
+ end
73
+ base = <<-eos
74
+ RUN mkdir /var/run/sshd
75
+ RUN echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts
76
+ RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
77
+ RUN echo kitchen:kitchen | chpasswd
78
+ RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
79
+ eos
80
+ [from, platform, base].join("\n")
55
81
  end
56
82
 
57
83
  def parse_image_id(output)
58
84
  output.each_line do |line|
59
85
  return line.split(/\s+/).last if line =~ /image id/i
60
86
  end
61
- raise ActionFailed, 'Could not parse Docker build output for image ID'
87
+ raise ActionFailed,
88
+ 'Could not parse Docker build output for image ID'
62
89
  end
63
90
 
64
91
  def build_image(state)
65
- output = run_command("cat #{dockerfile} | docker build -")
92
+ output = run_command("docker build -", :input => dockerfile)
66
93
  parse_image_id(output)
67
94
  end
68
95
 
@@ -77,7 +104,8 @@ module Kitchen
77
104
 
78
105
  def run_container(state)
79
106
  image_id = state[:image_id]
80
- output = run_command("docker run -d #{image_id} /usr/sbin/sshd -D -u0")
107
+ cmd = "docker run -d #{image_id} /usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no"
108
+ output = run_command(cmd)
81
109
  parse_container_id(output)
82
110
  end
83
111
 
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Docker Kitchen driver
24
- DOCKER_VERSION = "0.1.0.dev"
24
+ DOCKER_VERSION = "0.1.1.dev"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.dev
4
+ version: 0.1.1.dev
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -125,7 +125,6 @@ files:
125
125
  - Rakefile
126
126
  - kitchen-docker.gemspec
127
127
  - lib/kitchen/driver/docker.rb
128
- - lib/kitchen/driver/docker/Dockerfile
129
128
  - lib/kitchen/driver/docker_version.rb
130
129
  homepage: https://github.com/portertech/kitchen-docker
131
130
  licenses:
@@ -138,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
137
  requirements:
139
138
  - - ! '>='
140
139
  - !ruby/object:Gem::Version
141
- hash: 1116186526893056534
140
+ hash: 3422827801630028328
142
141
  version: '0'
143
142
  segments:
144
143
  - 0
@@ -1,17 +0,0 @@
1
- FROM ubuntu
2
-
3
- ENV DEBIAN_FRONTEND noninteractive
4
-
5
- RUN apt-get update
6
-
7
- RUN apt-get install -y sudo openssh-server
8
-
9
- RUN mkdir /var/run/sshd
10
-
11
- RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
12
-
13
- RUN echo kitchen:kitchen | chpasswd
14
-
15
- RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
16
-
17
- RUN echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts