Skip to content

Commit

Permalink
Add two flavors for VS containers
Browse files Browse the repository at this point in the history
Signed-off-by: oguzkaganozt <[email protected]>
  • Loading branch information
oguzkaganozt committed Mar 6, 2024
1 parent 70d844e commit 66f2552
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 12 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions .devcontainer/base/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Autoware",
"build": {
"dockerfile": "Dockerfile"
},
"remoteUser": "autoware",
"hostRequirements": {
"gpu": true
},
"runArgs": [
"--cap-add=SYS_PTRACE",

Check warning on line 11 in .devcontainer/base/devcontainer.json

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (PTRACE)
"--security-opt",
"seccomp=unconfined",

Check warning on line 13 in .devcontainer/base/devcontainer.json

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (seccomp)
"--net=host",
"--volume=/etc/localtime:/etc/localtime:ro"

Check warning on line 15 in .devcontainer/base/devcontainer.json

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (localtime)

Check warning on line 15 in .devcontainer/base/devcontainer.json

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (localtime)
],
"customizations": {
"vscode": {
"settings.json": {
"terminal.integrated.profiles.linux": { "bash": { "path": "/bin/bash" } }
}
}
}
}
14 changes: 14 additions & 0 deletions .devcontainer/cuda/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/autowarefoundation/autoware-openadk:latest-devel-cuda

ENV SHELL /bin/bash

ARG USERNAME=autoware
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Autoware",
"name": "Autoware-cuda",
"build": {
"dockerfile": "Dockerfile"
},
Expand Down
2 changes: 1 addition & 1 deletion ansible/playbooks/openadk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- name: Verify OS
ansible.builtin.fail:
msg: Only Ubuntu 22.04 is supported for this branch. Please refer to https://autowarefoundation.github.io/autoware-documentation/main/installation/autoware/source-installation/.
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version != '22.04'
when: ansible_distribution != 'Ubuntu' or ansible_distribution_version != '22.04'

- name: Print args
ansible.builtin.debug:
Expand Down
36 changes: 26 additions & 10 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To install without **NVIDIA GPU** support:

## Usage

### Runtime Setup
### Runtime

You can use `run.sh` to run the Autoware runtime container with the map data:

Expand All @@ -59,7 +59,7 @@ Inside the container, you can run the Autoware simulation by following these tut

[Rosbag Replay Simulation](../../tutorials/ad-hoc-simulation/rosbag-replay-simulation.md).

### Development Setup
### Development Environment

You can use [VS Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) to develop Autoware in the containerized environment with ease. Or you can use `run.sh` manually to run the Autoware development container with the workspace mounted.

Expand All @@ -68,18 +68,34 @@ You can use [VS Code Remote Containers](https://marketplace.visualstudio.com/ite
Get the Visual Studio Code's [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
And reopen the workspace in the container by selecting `Remote-Containers: Reopen in Container` from the Command Palette (`F1`).

By default devcontainer assumes NVIDIA GPU support, you can change this by deleting these lines within `.devcontainer/devcontainer.json`:
Autoware and Autoware-cuda are available containers for development.

```json
"hostRequirements": {
"gpu": true
},
```
If you want to use CUDA supported dev container, you need to install the NVIDIA Container Toolkit before opening the workspace in the container:

```bash
# Add NVIDIA container toolkit GPG key
sudo apt-key adv --fetch-keys https://nvidia.github.io/libnvidia-container/gpgkey
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg --import /etc/apt/trusted.gpg

# Add NVIDIA container toolkit repository
echo "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/$(dpkg --print-architecture) /" | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

# Update the package list
sudo apt-get update

```json
"--gpus", "all"
# Install NVIDIA Container Toolkit
sudo apt-get install -y nvidia-container-toolkit

# Add NVIDIA runtime support to docker engine
sudo nvidia-ctk runtime configure --runtime=docker

# Restart docker daemon
sudo systemctl restart docker
```

Then, you can use the `Remote-Containers: Reopen in Container` command to open the workspace in the container.


#### Using `run.sh` for Development

```bash
Expand Down

0 comments on commit 66f2552

Please sign in to comment.