fpm-fry 0.6.3 → 0.7.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/lib/fpm/fry/command/cook.rb +22 -6
- data/lib/fpm/fry/command.rb +1 -1
- data/lib/fpm/fry/recipe/builder.rb +4 -0
- 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: 15acbb0f9196652a3e2269a7e9dbfc9f3e0e215a42d7e24d03a955c17171ad5c
|
4
|
+
data.tar.gz: db1351dac3ce47056b35fc257eee88480292da50efa53c96cb5a14c68df8e794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73cf50dbd9e5e8105fbd37c8af6cf95655241121afa7ba0853b61b1a97e745f1d8ea1b6694dd492e9725f60b6296d443f0237b4837b9601d9bf678cdef9f442
|
7
|
+
data.tar.gz: 8a3aa11180a66194d08c7f9a7a643f3136b4455c74ba14b3342e4d6255cd034ad554a14b422540352075af055785bc1f4b2e101d3bc0f61874f77e92dd035881
|
data/lib/fpm/fry/command/cook.rb
CHANGED
@@ -5,9 +5,10 @@ module FPM; module Fry
|
|
5
5
|
option '--keep', :flag, 'Keep the container after build'
|
6
6
|
option '--overwrite', :flag, 'Overwrite package', default: true
|
7
7
|
option '--verbose', :fag, 'Verbose output', default: false
|
8
|
+
option '--platform', 'PLATFORM', default: nil
|
8
9
|
|
9
10
|
UPDATE_VALUES = ['auto','never','always']
|
10
|
-
option '--update',"<#{UPDATE_VALUES.join('|')}>", 'Update image before installing packages ( only apt currently )',attribute_name: 'update', default: 'auto' do |value|
|
11
|
+
option '--update',"<#{UPDATE_VALUES.join('|')}>", 'Update image before installing packages ( only apt currently )', attribute_name: 'update', default: 'auto' do |value|
|
11
12
|
if !UPDATE_VALUES.include? value
|
12
13
|
raise "Unknown value for --update: #{value.inspect}\nPossible values are #{UPDATE_VALUES.join(', ')}"
|
13
14
|
else
|
@@ -57,6 +58,7 @@ module FPM; module Fry
|
|
57
58
|
b = nil
|
58
59
|
Inspector.for_image(client, image) do |inspector|
|
59
60
|
variables = Detector.detect(inspector)
|
61
|
+
variables[:architecture] = platform
|
60
62
|
logger.debug("Loading recipe",variables: variables, recipe: recipe)
|
61
63
|
b = Recipe::Builder.new(variables, logger: ui.logger, inspector: inspector)
|
62
64
|
b.load_file( recipe )
|
@@ -124,11 +126,14 @@ module FPM; module Fry
|
|
124
126
|
if res.status == 404
|
125
127
|
df = DockerFile::Source.new(builder.variables.merge(image: image_id),cache)
|
126
128
|
begin
|
127
|
-
url = client.url("build
|
129
|
+
url = client.url("build")
|
130
|
+
query = { rm: 1, dockerfile: DockerFile::NAME, t: cachetag }
|
131
|
+
query[:platform] = platform if platform
|
128
132
|
client.post(
|
129
133
|
headers: {
|
130
134
|
'Content-Type'=>'application/tar'
|
131
135
|
},
|
136
|
+
query: query,
|
132
137
|
expects: [200],
|
133
138
|
path: url,
|
134
139
|
request_block: BlockEnumerator.new(df.tar_io)
|
@@ -145,11 +150,14 @@ module FPM; module Fry
|
|
145
150
|
df = DockerFile::Build.new(cachetag, builder.variables.dup,builder.recipe, update: update?)
|
146
151
|
parser = BuildOutputParser.new(out)
|
147
152
|
begin
|
148
|
-
url = client.url("build
|
153
|
+
url = client.url("build")
|
154
|
+
query = { rm: 1, dockerfile: DockerFile::NAME}
|
155
|
+
query[:platform] = platform if platform
|
149
156
|
res = client.post(
|
150
157
|
headers: {
|
151
158
|
'Content-Type'=>'application/tar'
|
152
159
|
},
|
160
|
+
query: query,
|
153
161
|
expects: [200],
|
154
162
|
path: url,
|
155
163
|
request_block: BlockEnumerator.new(df.tar_io),
|
@@ -198,14 +206,16 @@ module FPM; module Fry
|
|
198
206
|
def build!
|
199
207
|
body = begin
|
200
208
|
url = client.url('containers','create')
|
201
|
-
|
209
|
+
args = {
|
202
210
|
headers: {
|
203
211
|
'Content-Type' => 'application/json'
|
204
212
|
},
|
205
213
|
path: url,
|
206
214
|
expects: [201],
|
207
215
|
body: JSON.generate({"Image" => build_image})
|
208
|
-
|
216
|
+
}
|
217
|
+
args[:query] = { platform: platform } if platform
|
218
|
+
res = client.post(args)
|
209
219
|
JSON.parse(res.body)
|
210
220
|
rescue Excon::Error
|
211
221
|
logger.error "could not create #{build_image}, url: #{url}"
|
@@ -274,7 +284,7 @@ module FPM; module Fry
|
|
274
284
|
logger: logger,
|
275
285
|
client: client,
|
276
286
|
keep_modified_files: builder.keep_modified_files,
|
277
|
-
verbose: verbose
|
287
|
+
verbose: verbose,
|
278
288
|
)
|
279
289
|
builder.recipe.apply_input(input)
|
280
290
|
begin
|
@@ -331,6 +341,7 @@ module FPM; module Fry
|
|
331
341
|
|
332
342
|
out_map.each do |output, package|
|
333
343
|
package.apply_output(output)
|
344
|
+
adjust_package_architecture(output)
|
334
345
|
adjust_package_settings(output)
|
335
346
|
adjust_config_files(output)
|
336
347
|
end
|
@@ -348,6 +359,11 @@ module FPM; module Fry
|
|
348
359
|
|
349
360
|
end
|
350
361
|
|
362
|
+
def adjust_package_architecture(output)
|
363
|
+
# strip prefix and only use the architecture part
|
364
|
+
output.architecture = platform.split("/").last if platform
|
365
|
+
end
|
366
|
+
|
351
367
|
def adjust_package_settings( output )
|
352
368
|
# FPM ignores the file permissions on rpm packages.
|
353
369
|
output.attributes[:rpm_use_file_permissions?] = true
|
data/lib/fpm/fry/command.rb
CHANGED
@@ -12,7 +12,7 @@ module FPM; module Fry
|
|
12
12
|
|
13
13
|
option '--debug', :flag, 'Turns on debugging'
|
14
14
|
option '--[no-]tls', :flag, 'Turns on tls ( default is false for schema unix, tcp and http and true for https )'
|
15
|
-
option '--[no-]tlsverify', :flag, 'Turns off tls peer verification', default:true, environment_variable: 'DOCKER_TLS_VERIFY'
|
15
|
+
option '--[no-]tlsverify', :flag, 'Turns off tls peer verification', default: true, environment_variable: 'DOCKER_TLS_VERIFY'
|
16
16
|
option ["-t", "--tmpdir"], "PATH", 'Write tmp data to PATH', default: '/tmp/fpm-fry', attribute_name: :dir do |s|
|
17
17
|
String(s)
|
18
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm-fry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Lagresle
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2023-
|
16
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: excon
|