Merge pull request #26 from Tiryoh/feature/docker-support

Support both nvidia/without nvidia
This commit is contained in:
Zachary 2021-06-11 15:35:39 +08:00 committed by GitHub
commit 0f571ba071
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View file

@ -21,7 +21,8 @@ WORKDIR /catkin_ws/src
COPY . mycobot_ros
# Install build dependencies
RUN apt-get update && \
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - && \
apt-get update && \
apt-get install -y \
# ROS Build dependencies
python-rosinstall \

View file

@ -26,12 +26,20 @@ There are two ways to run this project. The first is by running the project in a
[installing docker-compose](https://docs.docker.com/compose/install/). The benefit of running in the container is that you can run the project in any version of linux, as long as your kernel
is new enough.
Once docker is installed, run the following command, and the project should show up:
Once docker is installed, run the following command, and the project should show up.
without NVIDIA GPU:
```
docker-compose build ros && xhost +local:root && docker-compose up ros
```
with NVIDIA GPU
```
docker-compose build nvidia-ros && xhost +local:root && docker-compose up nvidia-ros
```
This command does three things:
1) `docker-compose build ros`
@ -46,7 +54,7 @@ This command does three things:
3) `docker-compose up ros`
This runs the image specified in the `docker-compose.yml`, which by default runs
the command `roslaunch mycobot_ros control_slider.launch` within the container.
the command `roslaunch mycobot_ros mycobot_slider.launch` within the container.
### Option 2: Local

View file

@ -6,7 +6,7 @@ x-app: &common
environment:
PYTHONUNBUFFERED: 1
QT_X11_NO_MITSHM: 1
DISPLAY: :1
DISPLAY: $DISPLAY
volumes:
- "/tmp/.X11-unix:/tmp/.X11-unix:rw"
build:
@ -19,7 +19,9 @@ x-app: &common
services:
# This configuration builds the project for computers with NVIDIA hardware
nvidia-ros: *common
nvidia-ros:
<<: *common
runtime: nvidia
# This is the default for computers that don't have nvidia hardware accelerators
ros: