forked from kulmesa/communication_link
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·32 lines (24 loc) · 833 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
#!/bin/bash
set -euxo pipefail
module_path=$1
output_dir=$2
if [ ! -e "${module_path}" ]; then
echo "ERROR: module path not found!"
exit 1
fi
build_number=${GITHUB_RUN_NUMBER:=0}
THISDIR="$(dirname "$(readlink -f "$0")")"
mkdir -p "${module_path}/packaging/common/"
cp "${THISDIR}/scripts/package.sh" "${module_path}/packaging/common/package.sh"
iname=fog-sw-$(basename "$module_path")
docker build \
--build-arg MODULE_PATH="$module_path" \
--build-arg COMMIT_ID="$(git rev-parse HEAD)" \
--build-arg GIT_VER="$(git log --date=format:%Y%m%d --pretty=~git%cd.%h -n 1)" \
--build-arg BUILD_NUMBER="${build_number}" -t "${iname}" .
container_id=$(docker create "${iname}" "")
docker cp "${container_id}":/packages .
docker rm "${container_id}"
mkdir -p "$output_dir"
cp packages/*.deb "$output_dir"
rm -Rf packages