Skip to content

Commit

Permalink
Added docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
marip8 committed Nov 10, 2023
1 parent cfef9b1 commit adf85d0
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ARG TAG
FROM ghcr.io/tesseract-robotics/tesseract_qt_deploy:${TAG}

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND noninteractive

USER root

# Install ROS
ARG ROS_DISTRO
RUN apt install -y \
ros-${ROS_DISTRO}-ros-base \
ros-${ROS_DISTRO}-ament-cmake \
ros-${ROS_DISTRO}-ros2launch \
ros-${ROS_DISTRO}-launch-ros \
ros-${ROS_DISTRO}-launch-xml \
ros-${ROS_DISTRO}-launch-yaml

# Bind mount the source directory so as not to unnecessarily copy source code into the docker image
ARG WORKSPACE_DIR=/opt/tesseract_ros2
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract_ros2 \
source /opt/ros/${ROS_DISTRO}/setup.bash \
&& source /opt/tesseract_qt/install/setup.bash \
&& rosdep update --include-eol-distros \
&& rosdep install \
--from-paths ${WORKSPACE_DIR}/src \
-iry

# Build the repository
# Bind mount the source directory so as not to unnecessarily copy source code into the docker image
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract_ros2 \
source /opt/tesseract_qt/install/setup.bash \
&& source /opt/ros/${ROS_DISTRO}/setup.bash \
&& cd ${WORKSPACE_DIR} \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
&& rm -rf build log
28 changes: 28 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Tesseract Planning Docker

## Create the Docker image
### Download
Download a pre-built Docker image for this bridge from the container registry:

```
docker login ghcr.io
docker pull ghcr.io/tesseract-robotics/tesseract_planning_deploy:<tag>
```

### Build
Build the Docker image using `docker-compose`:

```commandLine
cd docker
docker compose build
```

## Run the docker image
Run the Docker image using `docker-compose`:

```commandLine
cd docker
CURRENT_UID=$(id -u):$(id -g) docker compose up
```

> Note: by default the docker image runs as a non-root user, so the environment variable `CURRENT_UID` must be supplied as shown above
30 changes: 30 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
tesseract:
build:
context: ..
dockerfile: docker/Dockerfile
args:
- TAG=focal-0.20
- ROS_DISTRO=foxy
environment:
DISPLAY: $DISPLAY
XAUTHORITY: $XAUTHORITY
NVIDIA_DRIVER_CAPABILITIES: all
ROS_LOG_DIR: /tmp
container_name: tesseract_ros2
image: ghcr.io/tesseract-robotics/tesseract_ros2_deploy:foxy-0.20
stdin_open: true
tty: true
network_mode: host
user: ${CURRENT_UID} # CURRENT_UID=$(id -u):$(id -g)
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- /etc/hosts:/etc/hosts
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

0 comments on commit adf85d0

Please sign in to comment.