-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·173 lines (133 loc) · 4.67 KB
/
build.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
shopt -s extdebug
shopt -s inherit_errexit
set -e
. build-scripts/loader-extended.bash
loader_addpath build-scripts/
# shellcheck source=build-scripts/libmain.sh
include libmain.sh
# shellcheck source=build-scripts/libbuild.sh
include libbuild.sh
# shellcheck source=build-scripts/libdefer.sh
include libdefer.sh
# shellcheck source=build-scripts/liblog.sh
include liblog.sh
# shellcheck source=build-scripts/libopt.sh
include libopt.sh
function main() {
local -A options
libopt_parse options \
stage:all preset:fast clobber:allow_if_matching_values \
build_no:0 generate_jenkins_init:no expose_ports:no -- "$@"
local preset="${options["preset"]}"
local stage="${options["stage"]}"
local clobber="${options["clobber"]}"
local build_no="${options["build_no"]}"
local generate_jenkins_init="${options["generate_jenkins_init"]}"
local expose_ports="${options["expose_ports"]}"
libmain_init iossifovlab.iossifovlab-gpf-containers igc
libmain_init_build_env clobber:"$clobber" preset:"$preset" build_no:"$build_no" \
generate_jenkins_init:"$generate_jenkins_init" expose_ports:"$expose_ports" \
iossifovlab.gpf-conda-packaging
libmain_save_build_env_on_exit
libbuild_init stage:"$stage" registry.seqpipe.org
defer_ret build_run_ctx_reset_all_persistent
defer_ret build_run_ctx_reset
build_stage "Cleanup"
{
build_run_ctx_init "container" "ubuntu:22.04"
defer_ret build_run_ctx_reset
build_run rm -rf \
./conda-channel \
./iossifovlab-gpf-base/gpf \
./iossifovlab-gpf-base/conda-channel \
./iossifovlab-gpf/gpf \
./iossifovlab-gpf/conda-channel \
./iossifovlab-gpf-full/gpfjs
}
local gpf_package_image
gpf_package_image=$(e docker_data_img_gpf_package)
local gpfjs_package_image
gpfjs_package_image=$(e docker_data_img_gpfjs_production_package)
local gpf_conda_packaging_channel
gpf_conda_packaging_channel=$(e docker_data_img_gpf_conda_packaging_channel)
build_stage "Draw build dependencies"
{
build_deps_graph_write_image 'build-env/dependency-graph.svg'
}
build_stage "Build iossifovlab-http"
{
build_run_local docker pull ubuntu:22.04
build_docker_image_create \
"iossifovlab-http" \
"iossifovlab-http" \
"iossifovlab-http/Dockerfile" \
"latest"
}
build_stage "Get conda channel"
{
build_docker_image_cp_from "$gpf_conda_packaging_channel" . /conda-channel/
}
local docker_img_iossifovlab_mamba_base_tag
docker_img_iossifovlab_mamba_base_tag="$(e docker_img_iossifovlab_mamba_base_tag)"
echo "docker_img_iossifovlab_mamba_base_tag=$docker_img_iossifovlab_mamba_base_tag"
build_stage "Build iossifovlab-gpf-base"
{
# copy gpf package
build_run_local mkdir ./iossifovlab-gpf-base/gpf
build_run_local bash -c 'cd ./iossifovlab-gpf-base/ &&
cp -rf ../conda-channel .'
build_docker_image_create \
"iossifovlab-gpf-base" \
"iossifovlab-gpf-base" \
"iossifovlab-gpf-base/Dockerfile" \
"$docker_img_iossifovlab_mamba_base_tag"
}
local docker_img_iossifovlab_gpf_base_tag
docker_img_iossifovlab_gpf_base_tag="$(e docker_img_iossifovlab_gpf_base_tag)"
build_stage "Build iossifovlab-gpf"
{
build_docker_image_create \
"iossifovlab-gpf" \
"iossifovlab-gpf" \
"iossifovlab-gpf/Dockerfile" \
"$docker_img_iossifovlab_gpf_base_tag"
}
build_stage "Build iossifovlab-gpf-import"
{
build_docker_image_create \
"iossifovlab-gpf-import" \
"iossifovlab-gpf-import" \
"iossifovlab-gpf-import/Dockerfile" \
"$docker_img_iossifovlab_gpf_base_tag"
}
build_stage "Build gpf-full"
{
# copy gpfjs package
build_run_local mkdir ./iossifovlab-gpf-full/gpfjs
build_docker_image_cp_from "$gpfjs_package_image" ./iossifovlab-gpf-full/ /gpfjs
local docker_repo
docker_repo=$(ee docker_repo)
local docker_img_iossifovlab_gpf_tag
docker_img_iossifovlab_gpf_tag=$(e docker_img_iossifovlab_gpf_tag)
local python_version
python_version=$(e gpf_conda_packaging_python_version)
build_docker_image_create "iossifovlab-gpf-full" "iossifovlab-gpf-full" \
./iossifovlab-gpf-full/Dockerfile \
"${docker_img_iossifovlab_gpf_tag}" \
PYTHON_VERSION="${python_version}"
}
build_stage "Build gpf fronting proxy"
{
local docker_repo
docker_repo=$(ee docker_repo)
local docker_img_iossifovlab_http_tag
docker_img_iossifovlab_http_tag=$(e docker_img_iossifovlab_http_tag)
build_docker_image_create \
"iossifovlab-gpf-fronting-proxy" \
"iossifovlab-gpf-fronting-proxy" \
"iossifovlab-gpf-fronting-proxy/Dockerfile" \
"$docker_img_iossifovlab_http_tag"
}
}
main "$@"