-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci_build
More file actions
executable file
·40 lines (28 loc) · 874 Bytes
/
ci_build
File metadata and controls
executable file
·40 lines (28 loc) · 874 Bytes
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
#!/bin/bash
set -e
RET=1
UUID="$( base64 /dev/urandom | tr -d '/+[A-Z]' | dd bs=16 count=1 2>/dev/null )"
IMAGE_NAME="command_handler_build_${UUID}"
function cleanup() {
set +e
echo "cleaning up"
docker rm -f "${IMAGE_NAME}"
docker rmi "${IMAGE_NAME}"
exit $RET
}
cd `dirname ${BASH_SOURCE[0]}`
BUILD_DIR="`pwd`/.build"
trap cleanup EXIT
mkdir -p "$BUILD_DIR"
docker build --build-arg="BUILD_DEBS=true" \
--pull --rm=true --force-rm --no-cache -t "${IMAGE_NAME}" .
BUILD_SCRIPT='
catkin_make install -DCMAKE_INSTALL_PREFIX=/opt/ros/melodic
lg-ros-build --ros_distro=melodic --os_version=bionic src/command_handler
mv ros-melodic-command-handler*.deb /output/
'
docker run --rm --name "${IMAGE_NAME}" \
--volume="${BUILD_DIR}:/output" \
"${IMAGE_NAME}" /bin/sh -ec "${BUILD_SCRIPT}"
RET=$?
echo "Finished. Packages should be in ${BUILD_DIR}/" >&2