Skip to content

Commit 3ef4179

Browse files
committed
Add docker-compose.yaml template and include example of usage
1 parent 8e81e3a commit 3ef4179

File tree

2 files changed

+31
-104
lines changed

2 files changed

+31
-104
lines changed

Dockerfile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ ARG MOVEIT_STUDIO_BASE_IMAGE
1010
ARG USERNAME=studio-user
1111
ARG USER_UID=1000
1212
ARG USER_GID=1000
13+
ARG BASE=base
1314

1415
##################################################
1516
# Starting from the specified MoveIt Pro release #
1617
##################################################
1718
# The image tag is specified in the argument itself.
1819
# hadolint ignore=DL3006
19-
FROM ${MOVEIT_STUDIO_BASE_IMAGE} AS base
20+
FROM ${MOVEIT_STUDIO_BASE_IMAGE} AS base-base
2021

2122
# Create a non-root user
2223
ARG USERNAME
@@ -49,18 +50,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
4950
/home/${USERNAME}/.ros && \
5051
chown -R $USER_UID:$USER_GID /home/${USERNAME} /opt/overlay_ws/
5152

52-
# IMPORTANT: Optionally install Nvidia drivers for improved simulator performance with Nvidia GPUs.
53-
# To do this you must
54-
# 1. Uncomment the ENV and RUN entries below
55-
# 2. Replace the 'nvidia-driver-555' apt package with the Nvidia driver version on your host, e.g. nvidia-driver-535, nvidia-driver-555. Use nvidia-smi on your host to determine the driver version.
56-
# After rebuilding via `moveit_pro build` verify the drivers are active in your container by running `nvidia_smi` inside of `moveit_pro shell`.
57-
# ENV DEBIAN_FRONTEND=noninteractive
58-
# RUN apt update && apt install -y software-properties-common
59-
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
60-
# --mount=type=cache,target=/var/lib/apt,sharing=locked \
61-
# add-apt-repository ppa:graphics-drivers/ppa && \
62-
# apt update && apt upgrade -y && apt install -y nvidia-driver-555
53+
FROM base-base AS base-nvidia
54+
ARG NVIDIA_DRIVER_PACKAGE
55+
ENV DEBIAN_FRONTEND=noninteractive
56+
# hadolint ignore=DL3008
57+
RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common
58+
# hadolint ignore=DL3008
59+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
60+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
61+
add-apt-repository ppa:graphics-drivers/ppa && \
62+
apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends "${NVIDIA_DRIVER_PACKAGE}"
6363

64+
ARG BASE
65+
# hadolint ignore=DL3006
66+
FROM base-${BASE} AS base
6467
# Install additional dependencies
6568
# You can also add any necessary apt-get install, pip install, etc. commands at this point.
6669
# NOTE: The /opt/overlay_ws folder contains MoveIt Pro binary packages and the source file.

docker-compose.yaml

Lines changed: 16 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,30 @@
1-
# Docker Compose file for user overlays of the MoveIt Pro images.
1+
# Docker Compose file that will be merged with /opt/moveit_pro/docker-compose.yaml.
2+
# For more details on how merging works, see https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/#merging-rules.
23

4+
# Services that are listed under `/opt/moveit_pro/docker-compose.yaml` are mirrored here for merging.
5+
# Feel free to remove services here that are unmodified.
36
services:
4-
# Sets common properties for other services. Should not be instantiated directly.
7+
# The base image that all MoveIt Pro services extend off of. Builds the user workspace.
58
base:
6-
# Extend the installed MoveIt Pro docker compose file.
7-
# Change this to match your environment, if MoveIt Pro was installed to a different location.
8-
extends:
9-
file: /opt/moveit_pro/docker-compose.yaml
10-
service: base
11-
image: moveit-pro-overlay
129
build:
13-
context: .
14-
target: user-overlay
10+
# List any arguments for building the user workspace here.
1511
args:
16-
- USER_UID=${STUDIO_USER_UID:-1000}
17-
- USER_GID=${STUDIO_USER_GID:-1000}
18-
- USERNAME=${STUDIO_USERNAME:-studio-user}
19-
- MOVEIT_STUDIO_BASE_IMAGE=picknikciuser/moveit-studio:${STUDIO_DOCKER_TAG:-main}
20-
21-
# Starts the MoveIt Pro Agent and the Bridge between the Agent and the Web UI
12+
# IMPORTANT: Optionally install Nvidia drivers for improved simulator performance with Nvidia GPUs.
13+
# To do this you must
14+
# 1. Uncomment the BASE and NVIDIA_DRIVER_PACKAGE build args below
15+
# 2. Replace the 'nvidia-driver-555' apt package with the Nvidia driver version on your host, e.g. nvidia-driver-535, nvidia-driver-555. Use nvidia-smi on your host to determine the driver version.
16+
# After rebuilding via `moveit_pro build` verify the drivers are active in your container by running `nvidia_smi` inside of `moveit_pro shell`.
17+
- BASE=nvidia
18+
- NVIDIA_DRIVER_PACKAGE=nvidia-driver-555
19+
20+
# Starts the MoveIt Pro Agent and the Bridge between the Agent and the Web UI.
2221
agent_bridge:
23-
extends: base
24-
privileged: true
25-
# This service relies on cgroup_rules defined in base which allow the user to use the host's network video4linux and usb_device devices.
26-
depends_on:
27-
rest_api:
28-
condition: service_healthy
29-
volumes:
30-
# Allow the user to run graphical programs from within the docker container.
31-
- /tmp/.X11-unix:/tmp/.X11-unix:ro
32-
# Allow access to host hardware e.g. RealSense cameras
33-
- /dev:/dev
34-
deploy:
35-
restart_policy:
36-
condition: any
37-
delay: 2s
38-
command: agent_bridge.app
39-
40-
# Starts the REST API for the Web UI.
41-
rest_api:
42-
extends: base
43-
healthcheck:
44-
test: "curl -f http://localhost:3200/objectives"
45-
interval: 5s
46-
timeout: 1m
47-
command: rest_api.app
4822

4923
# Starts the robot drivers.
5024
drivers:
51-
extends: base
52-
privileged: true
53-
# Ensures the drivers container has RT priority
54-
ulimits:
55-
rtprio: 99
56-
devices:
57-
- "/dev/ttyUSB0:/dev/ttyUSB0" # Allow access to the gripper.
58-
command: robot.app
5925

6026
# Starts the web UI frontend.
6127
web_ui:
62-
image: picknikciuser/moveit-studio-frontend:${STUDIO_DOCKER_TAG:-main}
63-
ports:
64-
- "80:80"
65-
network_mode: host
66-
67-
# Starts RViz for visualization.
68-
rviz:
69-
extends: base
70-
profiles:
71-
- rviz
72-
command: bash -c "ros2 launch moveit_studio_agent developer_rviz.launch.py"
7328

74-
# Starts MoveIt Setup Assistant for creating MoveIt configurations.
75-
setup_assistant:
76-
extends: base
77-
profiles:
78-
- setup_assistant
79-
command: bash -c "ros2 launch moveit_setup_assistant setup_assistant.launch.py"
80-
81-
# Developer specific configuration
29+
# Developer specific configuration when running `moveit_pro dev`.
8230
dev:
83-
extends: base
84-
build:
85-
target: user-overlay-dev
86-
image: moveit-studio-overlay-dev
87-
stdin_open: true
88-
tty: true
89-
privileged: true
90-
volumes:
91-
# Mount the source code, colcon generated artifacts, and ccache
92-
- ./src/:/home/${STUDIO_USERNAME:-studio-user}/user_ws/src:rw
93-
- ./build/:/home/${STUDIO_USERNAME:-studio-user}/user_ws/build:rw
94-
- ./install/:/home/${STUDIO_USERNAME:-studio-user}/user_ws/install:rw
95-
- ./log/:/home/${STUDIO_USERNAME:-studio-user}/user_ws/log:rw
96-
- ./.ccache/:/home/${STUDIO_USERNAME:-studio-user}/.ccache:rw
97-
- ${HOME}/.ros/log_moveit_pro:/home/${STUDIO_USERNAME:-studio-user}/.ros/log
98-
# Allow access to host hardware e.g. RealSense cameras
99-
- /dev:/dev
100-
command: sleep infinity
101-
# Making a separate profile prevents this service from being built when using `docker compose build`
102-
# and launched when using `docker compose up`.
103-
profiles: ["dev"]
104-
105-
volumes:
106-
ignition_resources:

0 commit comments

Comments
 (0)