-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·42 lines (35 loc) · 993 Bytes
/
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
#!/usr/bin/env bash
function build_all_packages() {
echo "Building all packages..."
# for each package from find_all_packages run build_package
for package in $(find_all_packages || exit); do
build_package "$package" || exit
done
}
function build_docker() {
echo "Building docker image..."
docker build -t api:latest . || exit
}
function build_package() {
path="$1"
package_name=$(basename "$path")
echo "Building package \"$package_name\"..."
(cd "$path" && python -m build --no-isolation) || exit
}
function collect_wheels() {
echo "Collecting wheels..."
rm -rf build || exit
mkdir -p build || exit
(find . -name "*.whl" -not -path "./build/*" -exec cp {} build \;) || exit
}
function find_all_packages() {
(find . -name "pyproject.toml" -not -path "./build/*" -exec dirname {} \;) || exit
}
function run_docker() {
echo "Running docker image..."
docker run --rm -it api:latest || exit
}
build_all_packages
collect_wheels
build_docker
run_docker