indocker 0.3.1 → 0.3.3
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/images/image.rb +26 -3
- data/lib/indocker/images/image_builder.rb +5 -0
- 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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75fb3f5b77d832b54c9f055f9baeff26dc14b6cf4fcbe740a9df05ff1402f07c
|
4
|
+
data.tar.gz: a01858bc28c0c243a1a397f5a4a364f5df5ddbdfa71f5ae74135e703265ceb31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe711686da87588d266f28953aafe462b5ec3d206f3307233ebf30859752fd7d8ae1a7bb65a5eab0c6182d3d1163234c1b1a4129f652726441b8f82241d6ac9f
|
7
|
+
data.tar.gz: 856d41ae64eaf250bd3b715e7d1dcc1567676036b19aadb7af03a809bb6f67b960575dbd111da7fd5c4cbe422e922e8295a9ac1981662ac03741cca6013c97d5
|
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)
|
@@ -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
|
@@ -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.3
|
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: 2023-
|
12
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|