16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/cide/builder.rb', line 16
def build(tag: nil, pull: nil, ssh_key: nil)
raise ArgumentError, 'tag missing' unless tag
if config.use_ssh
raise ArgumentError, 'ssh_key missing' unless ssh_key
unless File.exist?(ssh_key)
raise ArgumentError, "ssh_key #{ssh_key} not found"
end
create_tmp_file! TEMP_SSH_KEY, File.read(ssh_key)
end
create_tmp_file! DOCKERFILE, config.to_dockerfile
build_options = ['--force-rm']
build_options << '--pull' if pull
build_options.push '-f', DOCKERFILE
build_options.push '-t', tag
build_options << '.'
docker :build, *build_options
ensure
release_tmp_files!
end
|