Splits project into a docker environment folder and source code folder (for development). This change is mostly just renaming and moving files, but there are some changes to the gazebo Dockerfile to include all dependencies required for final development.

This commit is contained in:
Derek Witcpalek
2020-04-03 16:50:47 -04:00
parent 13d2ea9883
commit bf55093420
28 changed files with 87 additions and 33 deletions

View File

@@ -0,0 +1,64 @@
# Docker Compose
# docker-compose.yml format version
version: '3'
# Define services
services:
# ROS Development Service
ros-dev:
# Use Dockerfile in ros-dev folder
build: ./ros-dev
# Mount ros-dev folder on host to app folder in container
volumes:
- ./ros-dev:/app
# Set DISPLAY variable and network mode for GUIs
environment:
- DISPLAY=${IP_ADDRESS}:0.0
network_mode: "host"
# Set working directory in container to app folder
working_dir: /app
# ROS Turtlesim Service
ros-turtlesim:
# Use Dockerfile in ros-turtlesim folder
build: ./ros-turtlesim
# Mount ros-turtlesim folder on host to app folder in container
volumes:
- ./ros-turtlesim:/app
# Set DISPLAY variable and network mode for GUIs
environment:
- DISPLAY=${IP_ADDRESS}:0.0
network_mode: "host"
# Set working directory in container to app folder
working_dir: /app
# Run turtlesim script when container is run
command: bash -c "./turtlesim.sh"
# ROS Production Service
ros:
# Use Dockerfile in ros folder
build: ./ros
# Mount ros folder on host to app folder in container
volumes:
- ./ros:/app
# Set DISPLAY variable and network mode for GUIs
environment:
- DISPLAY=${IP_ADDRESS}:0.0
network_mode: "host"
# Set working directory in container to app folder
working_dir: /app
# Gazebo Production Service
gazebo:
# Use Dockerfile in gazebo folder
build: ./gazebo
# Mount gazebo folder on host to app folder in container
volumes:
- ./gazebo/.gazebo:/root/.gazebo
# Set DISPLAY variable and network mode for GUIs
environment:
- DISPLAY=${IP_ADDRESS}:0.0
network_mode: "host"
# Set working directory in container to app folder
working_dir: /app

View File

@@ -0,0 +1,43 @@
# Gazebo Dockerfile
# Use official image for Gazebo 9.x
FROM gazebo:gzserver9
# COPY $PWD/gazebo_models /root/.gazebo/models
RUN apt-get update
RUN apt-get install -y libgazebo9-dev
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
RUN apt-get install -y curl
RUN curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add -
RUN apt-get update
RUN apt-get install -y ros-melodic-desktop-full
RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
RUN apt install -y python-rosdep
RUN rosdep init
RUN rosdep update
# user id 1000 should be the same as the host user, so that you can access files
# from inside the docker container and also on the host
RUN useradd -u 1000 rrrobot
# set to no password
RUN passwd --delete rrrobot
# add to sudo users
RUN usermod -aG sudo rrrobot
# set the entry point
WORKDIR /home/rrrobot
RUN chown -R rrrobot:rrrobot /home/rrrobot
#COPY $RRROBOT_HOME/src /home/rrrobot/src
#COPY /home/dwitcpa/eecs467/rrrobot/src /home/rrrobot
RUN echo "source /opt/ros/melodic/setup.bash" >> /home/rrrobot/.bashrc
RUN echo "source /usr/share/gazebo/setup.sh" >> /home/rrrobot/.bashrc
RUN echo "export GAZEBO_MODEL_PATH=/home/rrrobot/rrrobot_src/src/gazebo_models:\$GAZEBO_MODEL_PATH" >> /home/rrrobot/.bashrc
RUN echo "export GAZEBO_PLUGIN_PATH=/home/rrrobot/rrrobot_src/lib:\$GAZEBO_PLUGIN_PATH" >> /home/rrrobot/.bashrc
#RUN chown -R rrrobot:rrrobot /home/rrrobot/.gazebo
USER rrrobot
CMD ["/bin/bash"]

1
docker_env/gazebo/build.sh Executable file
View File

@@ -0,0 +1 @@
docker image build . -t eecs467:rrrobot

View File

@@ -0,0 +1 @@
../../run_rrrobot_image.sh

View File

@@ -0,0 +1,16 @@
# ROS Development Dockerfile
# Use official image for ROS Melodic Morenia
FROM ros:melodic
# Install dependencies for development
RUN sudo apt-get update && apt-get install -y \
# ROS Tutorial Dependencies
ros-melodic-ros-tutorials \
ros-melodic-rqt \
ros-melodic-rqt-common-plugins \
ros-melodic-turtlesim \
# C++ Development: g++ compiler, etc.
build-essential
CMD ["/bin/bash"]

1
docker_env/ros-dev/build.sh Executable file
View File

@@ -0,0 +1 @@
docker image build . --rm -t eecs467:rrrobot

View File

@@ -0,0 +1 @@
../run_rrrobot_image.sh

View File

@@ -0,0 +1,10 @@
# ROS Turtlesim Dockerfile
# Use official image for ROS Melodic Morenia
FROM ros:melodic
# Install turtlesim dependencies
RUN sudo apt-get update && apt-get install -y \
ros-melodic-ros-tutorials
CMD ["/bin/bash"]

View File

@@ -0,0 +1 @@
docker image build . --rm -t eecs467:rrrobot

View File

@@ -0,0 +1,5 @@
#docker run -i -h rrrobot-env -t eecs467:rrrobot bash
xhost +local:docker #rrrobot-env
docker run -it --rm --privileged --device=/dev/dri:/dev/dri -e DISPLAY=$DISPLAY -v $PWD:/app -v /tmp/.X11-unix:/tmp/.X11-unix -h rrrobot-env eecs467:rrrobot
xhost -local:docker #rrrobot-env

View File

@@ -0,0 +1,6 @@
# turtlesim.sh
#!/bin/bash
roscore &
rosrun turtlesim turtlesim_node &
rosrun turtlesim turtle_teleop_key

10
docker_env/ros/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
# ROS Dockerfile
# Use official image for ROS Melodic Morenia
FROM ros:melodic
# Install dependencies for development
RUN sudo apt-get update && apt-get install -y \
build-essential
CMD ["/bin/bash"]

1
docker_env/ros/build.sh Executable file
View File

@@ -0,0 +1 @@
docker image build . --rm -t eecs467:rrrobot

View File

@@ -0,0 +1,5 @@
#docker run -i -h rrrobot-env -t eecs467:rrrobot bash
#docker run -it --rm --security-opt seccomp=unconfined -v $SSH_AUTH_SOCK:/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent --device=/dev/dri:/dev/dri -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --env QT_X11_NO_MITSHM=1 -h rrrobot-env eecs467:rrrobot
../run_rrrobot_image.sh