Add build scripts & docker scripts
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
This commit is contained in:
parent
b46bd7ffff
commit
8fc3f4bc71
6 changed files with 127 additions and 0 deletions
15
scripts/build.sh
Executable file
15
scripts/build.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# It is assumed that this script is called from the root of the project
|
||||||
|
WORKSPACE=$(pwd)
|
||||||
|
echo "WORKSPACE is $WORKSPACE"
|
||||||
|
|
||||||
|
CYCLONEDDS_INSTALL_PREFIX=$WORKSPACE/build/install/
|
||||||
|
|
||||||
|
rm -rf build/
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=$CYCLONEDDS_INSTALL_PREFIX -DBUILD_IDLC=ON ..
|
||||||
|
cmake --build .
|
||||||
|
cmake --build . --target install
|
9
scripts/docker/Dockerfile
Normal file
9
scripts/docker/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
# Dependencies required to build cyclonedds
|
||||||
|
RUN apt update && apt install -y \
|
||||||
|
cmake \
|
||||||
|
default-jdk \
|
||||||
|
maven \
|
||||||
|
g++
|
||||||
|
|
8
scripts/docker/DockerfileCycloneDds
Normal file
8
scripts/docker/DockerfileCycloneDds
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Build a docker image with pre-built cyclonedds core & examples
|
||||||
|
FROM ubuntu:cyclonedds
|
||||||
|
|
||||||
|
ADD . /cyclonedds
|
||||||
|
|
||||||
|
WORKDIR /cyclonedds
|
||||||
|
|
||||||
|
RUN ./scripts/build.sh
|
7
scripts/docker/README.md
Normal file
7
scripts/docker/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Overview
|
||||||
|
|
||||||
|
This contains helper scripts (Linux) to
|
||||||
|
- Build docker image (this contains the dependencies of cyclonedds build & can be used to build cyclonedds)
|
||||||
|
- Build docker image with pre-built cyclonedds (can be used for quick testing)
|
||||||
|
|
||||||
|
|
16
scripts/docker/build_cyclonedds.sh
Executable file
16
scripts/docker/build_cyclonedds.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# It is assumed that this script is run from root of the project
|
||||||
|
WORKSPACE=$(pwd)
|
||||||
|
IMAGE_NAME="ubuntu:cyclonedds"
|
||||||
|
CONTAINER_NAME="cyclonedds"
|
||||||
|
|
||||||
|
echo "WORKSPACE is $WORKSPACE"
|
||||||
|
|
||||||
|
docker run -it --rm -v $WORKSPACE/:/cyclonedds --workdir /cyclonedds $IMAGE_NAME /bin/bash -c "./scripts/build.sh"
|
||||||
|
# Launch the docker after build
|
||||||
|
docker run --name $CONTAINER_NAME -it -v $WORKSPACE/:/cyclonedds --workdir /cyclonedds $IMAGE_NAME /bin/bash
|
||||||
|
# If you want to connect to the above docker to run cyclonedds examples (multiple apps in separate terminals) , use the below command
|
||||||
|
docker exec -it cyclonedds /bin/bash
|
72
scripts/docker/build_docker_image.sh
Executable file
72
scripts/docker/build_docker_image.sh
Executable file
|
@ -0,0 +1,72 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BUILD_UBUNTU=false
|
||||||
|
BUILD_CYCLONEDDS=false
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo ""
|
||||||
|
echo "Helper script to build docker images for cyclonedds"
|
||||||
|
echo "Usage : "
|
||||||
|
echo "<workspace>/scripts/docker/build_docker_image.sh [images]"
|
||||||
|
echo "Supported images are "
|
||||||
|
echo "ubuntu : ubuntu based image to build cyclone dds. Contains dependencies to build cyclonedds."
|
||||||
|
echo "cyclonedds : pre-built cyclonedds core libs & example applications. Can be quickly used to test cyclonedds apps."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args() {
|
||||||
|
for arg in "$@"
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
-h | --help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
ubuntu)
|
||||||
|
BUILD_UBUNTU=true
|
||||||
|
;;
|
||||||
|
cyclonedds)
|
||||||
|
BUILD_CYCLONEDDS=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR : unknown parameter $arg"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "Supply at least one argument"
|
||||||
|
echo "Run with -h/--help for usage"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
parse_args $@
|
||||||
|
|
||||||
|
|
||||||
|
DOCKERFILE_DIR="$(dirname "$(readlink -fm "$0")")"
|
||||||
|
WORKSPACE="$(dirname "$(dirname "${DOCKERFILE_DIR}")")"
|
||||||
|
echo "WORKSPACE is $WORKSPACE"
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
|
||||||
|
if [ $BUILD_UBUNTU == true ]
|
||||||
|
then
|
||||||
|
UBUNTU_IMAGE="ubuntu:cyclonedds"
|
||||||
|
docker build --file "${DOCKERFILE_DIR}/Dockerfile" . --tag "${UBUNTU_IMAGE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $BUILD_CYCLONEDDS == true ]
|
||||||
|
then
|
||||||
|
CYCLONEDDS_IMAGE="cyclonedds:latest"
|
||||||
|
docker build --file "${DOCKERFILE_DIR}/DockerfileCycloneDds" . --tag "${CYCLONEDDS_IMAGE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue