diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..88d55e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ros:kinetic-ros-base + +# Install libraries and tools. +RUN apt-get update \ + && apt-get install -y wget \ + && wget -qO- https://deb.nodesource.com/setup_8.x | bash - \ + && apt-get install -y \ + ros-kinetic-web-video-server \ + ros-kinetic-rosbridge-suite \ + python-pip \ + nodejs \ + && pip install Flask + +WORKDIR /catkin_ws + +# Copy over required source files. +COPY web_console src/web_console +COPY commander src/commander + +# Build the source files. +RUN bash -c 'source /opt/ros/kinetic/setup.bash; catkin_make' + +# Setup image entry point. +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh", "roslaunch"] diff --git a/README.md b/README.md index e7a665c..c2f4f6f 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,37 @@ roslaunch web_console web_console.launch 3. **web_console** is now running on http://localhost:9999. +### Running (production, Docker) +1. Build Docker image: +```bash +docker build -t ros-cam . +``` + +2. Create a Docker network: +```bash +docker network create ros-cam-net +``` + +3. Start **commander**: +```bash +docker run -dit --rm \ + --net ros-cam-net \ + --name commander \ + ros-cam \ + commander commander.launch +``` + +4. Start **web_console**: +```bash +docker run -dit --rm \ + --net ros-cam-net \ + --name web_console \ + --env ROS_MASTER_URI=http://commander:11311 \ + -p 8888:8888 -p 9090:9090 -p 9999:9999 \ + ros-cam \ + web_console web_console.launch +``` + ### Running (development) 1. Open first terminal and run **commander** package: ```bash diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..a6b96a8 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +source '/opt/ros/kinetic/setup.bash' +source '/catkin_ws/devel/setup.bash' + +exec "$@"