-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
102 lines (101 loc) · 2.9 KB
/
docker-compose.yaml
File metadata and controls
102 lines (101 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
version: "3.9"
services:
gpu:
build:
context: .
dockerfile: docker/Dockerfile
target: gpu
args:
- REPO=${REPO}
- ROS_DISTRO=${ROS_DISTRO}
image: ${REPO}-base:${ROS_DISTRO}
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# Base image containing dependencies.
base:
extends: gpu
build:
context: .
dockerfile: docker/Dockerfile
args:
- REPO=${REPO}
- ROS_DISTRO=${ROS_DISTRO}
target: base
ports:
- 5000:5000
image: ${REPO}-base:${ROS_DISTRO}
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# Needed to display graphical applications
privileged: True
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
# # Needed to access the GPU
# - NVIDIA_DRIVER_CAPABILITIES=all
# Needed to run ROS 2 nodes
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-0}
- TERM=xterm-256color
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
# Mount devices and configuration files
- /dev:/dev
- /etc/udev:/etc/udev:ro
# Mount ssh keys and git config
- ~/.ssh:${HOME}/.ssh:ro
- ~/.gitconfig:${HOME}/.gitconfig:ro
# Mount group and passwd files for user permissions
- /etc/group:/etc/group:ro
- /etc/passwd:/etc/passwd:ro
- /etc/shadow:/etc/shadow:ro
# Overlay image containing the example source code.
overlay:
extends: base
image: ${REPO}-overlay:${ROS_DISTRO}
build:
context: .
dockerfile: docker/Dockerfile
target: overlay
args:
- SIM_REPO=${SIM_REPO}
- SIM_REPO_ENV=${SIM_REPO_ENV}
# Developer container
dev:
extends: overlay
image: ${REPO}-dev:${ROS_DISTRO}
build:
context: .
dockerfile: docker/Dockerfile
target: dev
args:
- UID=${UID:-1000}
- GID=${UID:-1000}
- USERNAME=${USERNAME:-devuser}
volumes:
# Mount the source codec
- ./${REPO}:/overlay_ws/src/${REPO}:rw
# Mount colcon build artifacts for faster rebuilds
- ./.colcon/build/:/overlay_ws/build/:rw
- ./.colcon/install/:/overlay_ws/install/:rw
- ./.colcon/log/:/overlay_ws/log/:rw
# Mount docker directory for faster edits to Dockerfile
- ./docker:/overlay_ws/docker:rw
# Mount .devcontainer directory for faster edits to devcontainer.json
- ./.devcontainer:/overlay_ws/.devcontainer:rw
# Mount .vscode directory for faster edits
- ./.vscode:/overlay_ws/.vscode:rw
user: ${USERNAME:-devuser}
container_name: ${USER}-${REPO}-dev
command: bash -c "bash"