fpm-dockery 0.1.0 → 0.1.1
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/CHANGELOG.md +9 -0
- data/lib/fpm/dockery/cli.rb +18 -4
- data/lib/fpm/dockery/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f32f78d6ae454c52ef25fe144f36976b98d342f
|
4
|
+
data.tar.gz: 5eb288fd9f7db6d2c05ccf025e46f7f47d33b403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f730d49772a2e937dd6d2603da20706684e54ae7f3b36f749f057408f0ec9e34f2be2d8b50cb7519c2e9fec00ed78108affe4741ddd26ffdd79f37769959320
|
7
|
+
data.tar.gz: 7beceb3533101cf991e1a7e57d236d2edcdb3f3f95465423d1722cb9a232dec59fe7bbb62bae0b6c3eec21aaca15a758b9e0cc7c836727f27a404f52cdd73747
|
data/CHANGELOG.md
ADDED
data/lib/fpm/dockery/cli.rb
CHANGED
@@ -8,10 +8,13 @@ module FPM
|
|
8
8
|
include Logging
|
9
9
|
include Utils
|
10
10
|
|
11
|
+
# List all valid builders by listing the Dockerfile.* files in
|
12
|
+
# the docker directory.
|
11
13
|
def valid_builders
|
12
14
|
Dir.glob("#{FPM::Dockery.root}/docker/Dockerfile.*").map {|f| File.basename(f.gsub('Dockerfile.', ''))}
|
13
15
|
end
|
14
16
|
|
17
|
+
# Check the builder is one we have a Dockerfile for.
|
15
18
|
def validate_builder!
|
16
19
|
unless valid_builders.include?(builder)
|
17
20
|
fatal "Image type must be one of: #{valid_builders.join(', ')}"
|
@@ -19,6 +22,7 @@ module FPM
|
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
25
|
+
# Create a builder image if it doesn't exist.
|
22
26
|
def create_builder_if_required
|
23
27
|
image_check = Subprocess.run("docker images | awk '{print $1}' | grep fpm-dockery/#{builder}")
|
24
28
|
unless image_check.exitstatus == 0
|
@@ -27,6 +31,7 @@ module FPM
|
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
34
|
+
# Create a builder image.
|
30
35
|
def create_builder(no_cache)
|
31
36
|
validate_builder!
|
32
37
|
cache_option = no_cache ? '--no-cache=true' : ''
|
@@ -55,11 +60,13 @@ module FPM
|
|
55
60
|
create_builder(no_cache?)
|
56
61
|
end
|
57
62
|
end
|
58
|
-
|
63
|
+
|
64
|
+
# The package command implementation.
|
59
65
|
class PackageCommand < BaseCommand
|
60
66
|
parameter "RECIPE", "fpm-cookery recipe to build"
|
61
67
|
parameter "BUILDER", "Builder to use"
|
62
68
|
parameter "[PACKAGE_DIR]", "Where to place the packages created by the build (defaults to /pkg in same dir as recipe)"
|
69
|
+
option "--skip-package", :flag, "Skip package building (identical to fpm-cook --skip-package)"
|
63
70
|
|
64
71
|
def execute
|
65
72
|
recipe_path = File.expand_path(recipe)
|
@@ -69,23 +76,30 @@ module FPM
|
|
69
76
|
validate_builder!
|
70
77
|
create_builder_if_required
|
71
78
|
|
72
|
-
|
79
|
+
extra_docker_commands = []
|
80
|
+
extra_fpm_cook_commands = []
|
81
|
+
|
73
82
|
pkg_dir = "/recipe/pkg"
|
74
83
|
|
75
84
|
if package_dir
|
76
|
-
|
85
|
+
extra_docker_commands << "-v #{File.expand_path(package_dir)}:/output"
|
77
86
|
pkg_dir = "/output"
|
78
87
|
end
|
88
|
+
|
89
|
+
if skip_package?
|
90
|
+
extra_fpm_cook_commands << "--skip-package"
|
91
|
+
end
|
79
92
|
|
80
93
|
command = <<eos
|
81
94
|
docker run \
|
82
95
|
-v #{dir_to_mount}:/recipe \
|
83
|
-
#{
|
96
|
+
#{extra_docker_commands.join(' ')} \
|
84
97
|
fpm-dockery/ubuntu \
|
85
98
|
--tmp-root /tmp/tmproot \
|
86
99
|
--pkg-dir #{pkg_dir} \
|
87
100
|
--cache-dir /tmp/cache \
|
88
101
|
package \
|
102
|
+
#{extra_fpm_cook_commands.join(' ')} \
|
89
103
|
/recipe/#{name_of_recipe}
|
90
104
|
eos
|
91
105
|
exit_status = Subprocess.run(command)
|
data/lib/fpm/dockery/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm-dockery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Sykes
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".ruby-gemset"
|
65
65
|
- ".ruby-version"
|
66
|
+
- CHANGELOG.md
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE
|
68
69
|
- README.md
|