-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_and_push_pt3.rb
executable file
·55 lines (46 loc) · 1.13 KB
/
build_and_push_pt3.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env ruby
# frozen_string_literal: true
BUILD_ONLY = false
COMMON_CHAIN_NAME = "khala-pt3"
COMMON_TAG = "23073101"
DEV_NODE_DOCKER_REPO = "#{COMMON_CHAIN_NAME}-node"
DEV_NODE_DOCKER_TAG = COMMON_TAG
REGISTRIES = [
# "jasl123",
"phalanetwork",
# "swr.cn-east-3.myhuaweicloud.com/phala",
]
require "open3"
def run(cmd)
Open3.popen2e(cmd) do |_stdin, stdout_err, wait_thr|
while (line = stdout_err.gets)
puts line
end
exit_status = wait_thr.value
unless exit_status.success?
abort "error"
end
end
end
# Build Khala-Dev-Node
REGISTRIES.each do |registry|
[
"docker build -f prebuilt_pt3_node.Dockerfile -t #{registry}/#{DEV_NODE_DOCKER_REPO}:#{DEV_NODE_DOCKER_TAG} .",
"docker build -f prebuilt_pt3_node.Dockerfile -t #{registry}/#{DEV_NODE_DOCKER_REPO} ."
].each do |cmd|
puts cmd
run cmd
end
end
unless BUILD_ONLY
# Push Khala-Dev-Node
REGISTRIES.each do |registry|
[
"docker push #{registry}/#{DEV_NODE_DOCKER_REPO}:#{DEV_NODE_DOCKER_TAG}",
"docker push #{registry}/#{DEV_NODE_DOCKER_REPO}"
].each do |cmd|
puts cmd
run cmd
end
end
end