indocker 0.3.0 → 0.3.2
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/indocker/containers/restart_policy.rb +1 -1
- data/lib/indocker/docker_run_args.rb +2 -2
- data/lib/indocker/images/image.rb +26 -3
- data/lib/indocker/images/image_builder.rb +6 -2
- data/lib/indocker/images/image_compiler.rb +2 -2
- data/lib/indocker/images/template_compiler.rb +6 -1
- data/lib/indocker/images/templates_compiler.rb +3 -2
- data/lib/indocker/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f776697e00b04e80d3c11c4f39b17a6d107d69607c05c17e4f425c72de194a
|
4
|
+
data.tar.gz: 370541638e5e70251caec9ee1246d8e0dcbecc46085a9dbc2e5500916020ff6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f643dea4d15f217f5aa90e45d53c4eb9bce152465f543b8f3c98291363f9f662d8ee90f63d8b7292388cb8d1423622268bec0a6e778a0c270018f39e2c2f5a93
|
7
|
+
data.tar.gz: c1738314439b883d66baf8f78e7db6249ee196d8ca4f00d0c7d76d658a5783424ec677dd9092f17f8188c4566fd4a369be80eb70bf0ae46beb03610a692efa81
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
indocker (0.3.
|
4
|
+
indocker (0.3.2)
|
5
5
|
net-ssh
|
6
6
|
|
7
7
|
GEM
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
diff-lcs (1.5.0)
|
12
12
|
docile (1.4.0)
|
13
13
|
method_source (1.0.0)
|
14
|
-
net-ssh (7.0
|
14
|
+
net-ssh (7.1.0)
|
15
15
|
pry (0.14.1)
|
16
16
|
coderay (~> 1.1)
|
17
17
|
method_source (~> 1.0)
|
@@ -10,7 +10,7 @@ class Indocker::Containers::RestartPolicy
|
|
10
10
|
|
11
11
|
def restart?(container, timestamp)
|
12
12
|
file = timestamp_file(container)
|
13
|
-
return true if !File.
|
13
|
+
return true if !File.exist?(file)
|
14
14
|
|
15
15
|
last_timestamp = File.read(file).strip
|
16
16
|
timestamp != last_timestamp
|
@@ -24,7 +24,7 @@ class Indocker::DockerRunArgs
|
|
24
24
|
|
25
25
|
path = Indocker::EnvFileHelper.path(env_file)
|
26
26
|
|
27
|
-
if !File.
|
27
|
+
if !File.exist?(path)
|
28
28
|
raise ArgumentError.new("env file not found: #{path}")
|
29
29
|
end
|
30
30
|
|
@@ -61,7 +61,7 @@ class Indocker::DockerRunArgs
|
|
61
61
|
end
|
62
62
|
|
63
63
|
sysctl = container.get_start_option(:sysctl)
|
64
|
-
|
64
|
+
|
65
65
|
if sysctl
|
66
66
|
Array(sysctl).each do |val|
|
67
67
|
args.push("--sysctl #{val}")
|
@@ -1,9 +1,8 @@
|
|
1
1
|
class Indocker::Images::Image
|
2
|
-
attr_reader :name
|
3
|
-
attr_reader :dependent_images
|
4
|
-
attr_reader :build_args
|
2
|
+
attr_reader :name, :compile, :compile_rpaths, :dependent_images, :build_args
|
5
3
|
|
6
4
|
def initialize(name)
|
5
|
+
@compile = false
|
7
6
|
@name = name
|
8
7
|
@dependent_images = []
|
9
8
|
@build_args = {}
|
@@ -37,6 +36,30 @@ class Indocker::Images::Image
|
|
37
36
|
@dockerfile = path
|
38
37
|
end
|
39
38
|
|
39
|
+
def compile?(path)
|
40
|
+
return false if !@compile
|
41
|
+
return true if @compile_rpaths.empty?
|
42
|
+
return true if @compile_rpaths.any? { |rpath| path.include?(rpath) }
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_compile(flag_or_rpaths)
|
47
|
+
@compile_rpaths = []
|
48
|
+
|
49
|
+
if flag_or_rpaths == false
|
50
|
+
@compile = false
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
54
|
+
@compile = true
|
55
|
+
|
56
|
+
if flag_or_rpaths.is_a?(Array)
|
57
|
+
@compile_rpaths = flag_or_rpaths
|
58
|
+
end
|
59
|
+
|
60
|
+
@dockerfile = path
|
61
|
+
end
|
62
|
+
|
40
63
|
def dockerfile
|
41
64
|
@dockerfile || (raise ArgumentError.new("Dockerfile path is not set for image :#{@name}"))
|
42
65
|
end
|
@@ -6,7 +6,7 @@ class Indocker::Images::ImageBuilder
|
|
6
6
|
@image = Indocker::Images::Image.new(name)
|
7
7
|
dockerfile = File.join(dir, 'Dockerfile')
|
8
8
|
|
9
|
-
if File.
|
9
|
+
if File.exist?(dockerfile)
|
10
10
|
@image.set_dockerfile(dockerfile)
|
11
11
|
end
|
12
12
|
|
@@ -35,7 +35,7 @@ class Indocker::Images::ImageBuilder
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def dockerfile(path)
|
38
|
-
if !File.
|
38
|
+
if !File.exist?(path)
|
39
39
|
raise ArgumentError.new("Dockerfile was not found in #{path}")
|
40
40
|
end
|
41
41
|
|
@@ -43,6 +43,10 @@ class Indocker::Images::ImageBuilder
|
|
43
43
|
self
|
44
44
|
end
|
45
45
|
|
46
|
+
def compile(flag_or_file_paths)
|
47
|
+
@image.set_compile(flag_or_file_paths)
|
48
|
+
end
|
49
|
+
|
46
50
|
def depends_on(*image_list)
|
47
51
|
if !image_list.is_a?(Array)
|
48
52
|
image_list = [image_list]
|
@@ -40,7 +40,7 @@ class Indocker::Images::ImageCompiler
|
|
40
40
|
templates_compiler = Indocker::Images::TemplatesCompiler.new
|
41
41
|
|
42
42
|
templates_compiler.compile(
|
43
|
-
|
43
|
+
image: image,
|
44
44
|
compile_dir: compile_dir,
|
45
45
|
context: build_context
|
46
46
|
)
|
@@ -50,7 +50,7 @@ class Indocker::Images::ImageCompiler
|
|
50
50
|
|
51
51
|
target_dockerfile = File.join(compile_dir, 'Dockerfile')
|
52
52
|
FileUtils.cp(image.dockerfile, target_dockerfile)
|
53
|
-
compiler.compile(target_dockerfile, build_context)
|
53
|
+
compiler.compile(target_dockerfile, build_context, image)
|
54
54
|
|
55
55
|
File
|
56
56
|
.join(compile_dir, '.dockerignore')
|
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'erb'
|
2
2
|
|
3
3
|
class Indocker::Images::TemplateCompiler
|
4
|
-
def compile(path, context)
|
4
|
+
def compile(path, context, image)
|
5
|
+
if !image.compile?(file)
|
6
|
+
Indocker.logger.debug("skipping ERB compilation for #{path}".grey)
|
7
|
+
return
|
8
|
+
end
|
9
|
+
|
5
10
|
Indocker.logger.debug("compiling template file #{path}".grey)
|
6
11
|
template = File.read(path)
|
7
12
|
content = ERB.new(template).result(context.helper.get_binding)
|
@@ -2,14 +2,15 @@ require 'erb'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
class Indocker::Images::TemplatesCompiler
|
5
|
-
def compile(
|
5
|
+
def compile(image:, compile_dir:, context:)
|
6
|
+
templates_dir = image.build_context
|
6
7
|
prepare_dirs!(templates_dir, compile_dir)
|
7
8
|
|
8
9
|
compiler = Indocker::Images::TemplateCompiler.new
|
9
10
|
|
10
11
|
Dir[File.join(compile_dir, '**/**')].each do |file|
|
11
12
|
next if !File.file?(file)
|
12
|
-
compiler.compile(file, context)
|
13
|
+
compiler.compile(file, context, image)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
data/lib/indocker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
|
-
rubygems_version: 3.3.
|
224
|
+
rubygems_version: 3.3.24
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: Docker Containers Deployment
|