Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
audrow committed Jun 24, 2020
0 parents commit b71911e
Show file tree
Hide file tree
Showing 24 changed files with 1,095 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
get-docker.sh
build/
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2020 Audrow Nash

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
README
======

.. image:: https://readthedocs.org/projects/cordial-docker/badge/?version=latest
:target: https://cordial-docker.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

See the `ReadTheDocs <https://cordial-docker.readthedocs.io/en/latest/index.html>`_ page.
3 changes: 3 additions & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
shared/
config/
shared*/
155 changes: 155 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
From osrf/ros:kinetic-desktop-full

# Set frontend to avoid debconf display errors
ENV DEBIAN_FRONTEND noninteractive

# Install essentials
RUN \
apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
software-properties-common \
apt-utils \
&& apt-get update -y \
&& apt-get install -y \
curl \
wget \
tmux \
zsh \
curl \
wget \
vim \
sudo \
libgl1-mesa-glx \
libgl1-mesa-dri \
mesa-utils \
unzip \
terminator \
git-gui \
fonts-powerline \
meld \
nautilus \
vlc \
&& sed -i 's/geteuid/getppid/' /usr/bin/vlc \
&& rm -rf /var/lib/apt/lists/*

# Setup Pycharm
RUN \
wget https://download.jetbrains.com/python/pycharm-community-2020.1.2.tar.gz \
&& mv pycharm-community-* pycharm-community.tar.gz \
&& tar xfz pycharm-*.tar.gz -C /opt/ \
&& rm pycharm-community.tar.gz \
&& echo 'alias pycharm="/opt/pycharm-community-2020.1.2/bin/pycharm.sh"' >> /root/.bashrc

# Install Visual Studio Code
RUN \
apt-get update -y \
&& apt-get install -y \
apt-transport-https \
ca-certificates \
&& curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \
&& mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \
&& sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' \
&& apt-get update -y \
&& apt-get install -y code \
&& rm -rf /var/lib/apt/lists/*

# Setup new ROS key + install ros packages
RUN \
apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116 \
&& apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 \
&& apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
ros-$ROS_DISTRO-ros-control \
ros-$ROS_DISTRO-ros-controllers \
ros-$ROS_DISTRO-gazebo-ros-pkgs \
ros-$ROS_DISTRO-gazebo-ros-control \
#ros-$ROS_DISTRO-rosbridge-server \
ros-$ROS_DISTRO-audio-common \
ros-$ROS_DISTRO-mongodb-store \
ros-$ROS_DISTRO-mongodb-log \
&& rm -rf /var/lib/apt/lists/*

# Setup Python2 for cordial
RUN \
apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
alsa \
gstreamer1.0-alsa \
vorbis-tools \
&& apt-get install -y \
python \
python-pip \
python-scipy \
python-gst0.10 \
python-mock \
python-pyaudio \
&& python2 -m pip install --upgrade pip \
&& python2 -m pip install \
rospkg \
catkin_pkg \
boto3==1.12.11 \
soundfile==0.10.3.post1 \
speedtest-cli==2.1.2 \
&& rm -rf /var/lib/apt/lists/*

# Setup HTTP server
RUN \
apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
nodejs \
npm \
&& npm install http-server -g \
&& ln -s /usr/bin/nodejs /usr/bin/node \
&& rm -rf /var/lib/apt/lists/*

# Setup Python3.6 with pip, virtualenv, and ROS
RUN \
add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
wget \
python3-pip \
python3-yaml \
python3-virtualenv \
python3-vcstool \
&& rm -rf /var/lib/apt/lists/*

# Setup MongoDB
RUN \
apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
python-pymongo \
mongodb \
scons \
&& rm -rf /var/lib/apt/lists/*


# Clone relevant repositories
#ENV commit_tag "abm_pilot"
# ENV git_options "-b ${commit_tag} --single-branch --recursive"
ENV git_options "--recursive"
RUN \
mkdir -p /root/ws/catkin_ws/src \
&& cd /root/ws/catkin_ws/src \
&& git clone ${git_options} https://github.com/robotpt/qt-robot \
&& git clone ${git_options} https://github.com/robotpt/cordial \
&& git clone https://github.com/RobotWebTools/rosbridge_suite


# Build repositories
RUN \
cd /root/ws/catkin_ws \
&& /bin/bash -c "source /opt/ros/kinetic/setup.bash && catkin_make"


# Put things you want in your ~/.bashrc here
RUN \
unset DEBIAN_FRONTEND \
&& echo " \
alias gs='git status'\n\
alias gl='git log --pretty=oneline --graph'\n\
alias gb='git branch -a'\n\
alias gg='git gui'\n\
alias gd='git diff HEAD'\n\
alias code='code --user-data-dir /root/.visual_code/'\n\
" >> ~/.bashrc
40 changes: 40 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3.4'

services:
cordial_docker:
build:
context: .
network: host
environment:
DISPLAY: $DISPLAY
QT_GRAPHICSSYSTEM: native
ROS_DISTRO: kinetic
ROS_MASTER_URI: $ROS_MASTER_URI
IS_DOCKER_ENV: "true"
privileged: true
network_mode: host
devices:
- /dev/dri:/dev/dri
- /dev/snd:/dev/snd
volumes:
- workspace:/root/ws
- pycharm_config:/root/.PyCharmCE2020.1.2/
- visual_code_plugins:/root/.vscode/
- visual_code_user_data:/root/.visual_code/
- aws_config:/root/.aws/
- ros_logs:/root/.ros/log
- ./shared/:/root/shared/
- ~/.gitconfig/:/root/.gitconfig/:ro
- ~/.vimrc/:/root/.vimrc/:ro
- ~/.vim/:/root/.vim/:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
working_dir: /root/

volumes:
workspace:
pycharm_config:
visual_code_user_data:
visual_code_plugins:
aws_config:
ros_logs:
30 changes: 30 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Go to the directory of this file -- needed for docker-compose
FILE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $FILE_DIR

if [ -z ${1+x} ];
then
MODE="popup";
else
MODE=$1;
fi

SERVICE_NAME="cordial_docker"
ROS_MASTER_URI=$ROS_MASTER_URI docker-compose up --build
case "$MODE" in
terminal | terminal_debug | t )
ROS_MASTER_URI=$ROS_MASTER_URI docker-compose run $SERVICE_NAME bash -c "source ~/ws/catkin_ws/devel/setup.bash && bash"
;;
stop | kill | down )
docker-compose down
;;
terminator | popup )
xhost +local: # share display on ubuntu platforms
ROS_MASTER_URI=$ROS_MASTER_URI docker-compose run $SERVICE_NAME bash -c "terminator -e \"echo 'Entering Docker Container...' && bash\""
;;
* )
echo "Not a valid command"
;;
esac

0 comments on commit b71911e

Please sign in to comment.