Fix PR comments
Signed-off-by: Prasanna Bhat <prasanna.yoga@gmail.com>
This commit is contained in:
parent
8776c3213b
commit
9df768b0f3
4 changed files with 53 additions and 12 deletions
|
@ -6,9 +6,46 @@ WORKSPACE=$(pwd)
|
||||||
echo "WORKSPACE is $WORKSPACE"
|
echo "WORKSPACE is $WORKSPACE"
|
||||||
|
|
||||||
CYCLONEDDS_INSTALL_PREFIX=$WORKSPACE/build/install/
|
CYCLONEDDS_INSTALL_PREFIX=$WORKSPACE/build/install/
|
||||||
|
CLEAN_BUILD=false
|
||||||
|
|
||||||
rm -rf build/
|
usage() {
|
||||||
mkdir build
|
echo ""
|
||||||
|
echo "Helper script to build cyclonedds"
|
||||||
|
echo "Usage : "
|
||||||
|
echo "<workspace>/scripts/build.sh [options]"
|
||||||
|
echo "Supported options are "
|
||||||
|
echo "clean : remove build folder (Default : keep build folder)"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args() {
|
||||||
|
for arg in "$@"
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
-h | --help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
clean)
|
||||||
|
CLEAN_BUILD=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR : unknown parameter $arg"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args $@
|
||||||
|
|
||||||
|
if [ $CLEAN_BUILD == true ]
|
||||||
|
then
|
||||||
|
rm -rf build/
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=$CYCLONEDDS_INSTALL_PREFIX -DBUILD_IDLC=ON ..
|
cmake -DCMAKE_INSTALL_PREFIX=$CYCLONEDDS_INSTALL_PREFIX -DBUILD_IDLC=ON ..
|
||||||
cmake --build .
|
cmake --build .
|
||||||
|
|
|
@ -5,4 +5,4 @@ ADD . /cyclonedds
|
||||||
|
|
||||||
WORKDIR /cyclonedds
|
WORKDIR /cyclonedds
|
||||||
|
|
||||||
RUN ./scripts/build.sh
|
RUN ./scripts/build.sh clean
|
|
@ -1,7 +1,7 @@
|
||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
This contains helper scripts to build & run cyclonedds core & example applications in docker.
|
This contains helper scripts to build & run cyclonedds core & example applications in docker.
|
||||||
Additionally you can also build a docker image with pre-built cyclonedds examples. This could be useful in quikly trying the examples (both IPC & network communication).
|
Additionally you can also build a docker image with pre-built cyclonedds examples. This could be useful in quickly trying the examples (both IPC & network communication).
|
||||||
|
|
||||||
# Bulid docker image
|
# Bulid docker image
|
||||||
There are two docker images you can build.
|
There are two docker images you can build.
|
||||||
|
@ -27,6 +27,7 @@ The following images are supported.
|
||||||
`ubuntu` : Same as **ubuntu:cyclonedds** , mentioned above.
|
`ubuntu` : Same as **ubuntu:cyclonedds** , mentioned above.
|
||||||
`cyclonedds` : Same as **cyclonedds:latest**, mentioned above.
|
`cyclonedds` : Same as **cyclonedds:latest**, mentioned above.
|
||||||
You can run the script with `-h` option to display usage information.
|
You can run the script with `-h` option to display usage information.
|
||||||
|
**NOTE** : *cyclonedds:latest* depends on image *ubuntu:cyclonedds*. You need to build *ubuntu:cyclonedds* first, if you want to use *cyclonedds:latest*.
|
||||||
- Build cyclonedds core & examples (if you are using **ubuntu:cyclonedds**)
|
- Build cyclonedds core & examples (if you are using **ubuntu:cyclonedds**)
|
||||||
Use the helper script `./scripts/docker/build_cyclonedds.sh` to build using the currently checked out revision.
|
Use the helper script `./scripts/docker/build_cyclonedds.sh` to build using the currently checked out revision.
|
||||||
**NOTE** : You need to run this script from the root of the project.
|
**NOTE** : You need to run this script from the root of the project.
|
||||||
|
@ -40,13 +41,16 @@ Let's do that !
|
||||||
|
|
||||||
## Run examples inside the same container (uses IPC)
|
## Run examples inside the same container (uses IPC)
|
||||||
- Launch docker container, from the root of the project
|
- Launch docker container, from the root of the project
|
||||||
`docker run --name cyclonedds -it -v $(pwd):/cyclonedds --workdir /cyclonedds cyclonedds:latest /bin/bash`
|
|
||||||
This will open terminal connected to docker @ root of the project.
|
```
|
||||||
|
docker run --name cyclonedds -it --workdir /cyclonedds/build/bin cyclonedds:latest /bin/bash
|
||||||
|
```
|
||||||
|
This will open terminal connected to docker @ bin of the project, which contains sample applications.
|
||||||
It will look something like this
|
It will look something like this
|
||||||
```
|
```
|
||||||
root@22ff409a33e1:/cyclonedds#
|
root@22ff409a33e1:/cyclonedds/build/bin#
|
||||||
```
|
```
|
||||||
- Navigate to `/build/bin` to run the example applications.
|
- From here you can run the example applications.
|
||||||
- To run another terminal , connected to same docker container, use the following command.
|
- To run another terminal , connected to same docker container, use the following command.
|
||||||
```
|
```
|
||||||
docker exec -it cyclonedds /bin/bash
|
docker exec -it cyclonedds /bin/bash
|
||||||
|
@ -57,7 +61,7 @@ Run the partner example here. This will establish communication over IPC channel
|
||||||
## Run examples in different containers (uses docker networking)
|
## Run examples in different containers (uses docker networking)
|
||||||
- Follow the same steps as in the previous section , instead connecting to existing docker container create a new docker container.
|
- Follow the same steps as in the previous section , instead connecting to existing docker container create a new docker container.
|
||||||
e.g.
|
e.g.
|
||||||
`docker run --name cyclonedds1 -it -v $(pwd):/cyclonedds --workdir /cyclonedds cyclonedds:latest /bin/bash`
|
`docker run --name cyclonedds1 -it --workdir /cyclonedds/build/bin cyclonedds:latest /bin/bash`
|
||||||
**NOTE** : You need to run this script from the root of the project.
|
**NOTE** : You need to run this script from the root of the project.
|
||||||
At this point you can inspect the traffic using wireshark.
|
At this point you can inspect the traffic using wireshark.
|
||||||
Open docker network interface (`docker0` on my system) in wireshark.
|
Open docker network interface (`docker0` on my system) in wireshark.
|
||||||
|
|
|
@ -9,7 +9,7 @@ CONTAINER_NAME="cyclonedds"
|
||||||
|
|
||||||
echo "WORKSPACE is $WORKSPACE"
|
echo "WORKSPACE is $WORKSPACE"
|
||||||
|
|
||||||
docker run -it --rm -v $WORKSPACE/:/cyclonedds --workdir /cyclonedds $IMAGE_NAME /bin/bash -c "./scripts/build.sh"
|
docker run -it --rm -v $WORKSPACE/:/cyclonedds --workdir /cyclonedds $IMAGE_NAME /bin/bash -c "./scripts/build.sh clean"
|
||||||
# Launch the docker after build
|
# Launch the docker after build
|
||||||
docker run --name $CONTAINER_NAME -it -v $WORKSPACE/:/cyclonedds --workdir /cyclonedds $IMAGE_NAME /bin/bash
|
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
|
# If you want to connect to the above docker to run cyclonedds examples (multiple apps in separate terminals) , use the below command
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue