Skip to content

Commit

Permalink
Update devcontainer and Docker manifest aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzkaganozt committed Jan 17, 2024
1 parent a69eb98 commit ed6c812
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 29 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/autowarefoundation/openadk:devel-latest-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
27 changes: 23 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
{
"name": "Autoware",
"image": "ghcr.io/autowarefoundation/autoware-openadk:devel-latest"

// "remoteUser": "autoware",
"name": "Autoware",
"build": {
"dockerfile": "Dockerfile"
},
"remoteUser": "autoware",
"hostRequirements": {
"gpu": true
},
"runArgs": [
"--cap-add=SYS_PTRACE",

Check warning on line 11 in .devcontainer/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/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/devcontainer.json

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (localtime)

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

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (localtime)
"--gpus", "all"
],
"customizations": {
"vscode": {
"settings.json": {
"terminal.integrated.profiles.linux": {"bash": {"path": "/bin/bash"}}
}
}
}
}
16 changes: 8 additions & 8 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,29 @@ runs:
echo "$EOF" >> $GITHUB_OUTPUT
shell: bash

- name: Docker meta for devel
id: meta-devel
- name: Docker meta for prebuilt
id: meta-prebuilt
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
bake-target: docker-metadata-action-devel
bake-target: docker-metadata-action-prebuilt
flavor: |
latest=false
prefix=${{ inputs.tag-prefix }}
suffix=devel${{ inputs.tag-suffix }}
suffix=prebuilt${{ inputs.tag-suffix }}
- name: Docker meta for prebuilt
id: meta-prebuilt
- name: Docker meta for devel
id: meta-devel
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
bake-target: docker-metadata-action-prebuilt
bake-target: docker-metadata-action-devel
flavor: |
latest=false
prefix=${{ inputs.tag-prefix }}
suffix=prebuilt${{ inputs.tag-suffix }}
suffix=devel${{ inputs.tag-suffix }}
- name: Docker meta for runtime
id: meta-runtime
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update-docker-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
with:
package-name: autoware-openadk

Check warning on line 22 in .github/workflows/update-docker-manifest.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (openadk)

- name: Create alias from 'autoware-openadk:{rosdistro}-latest' to 'autoware-openadk:latest'
- name: Create alias from 'autoware-openadk:{rosdistro}-latest-devel' to 'autoware-openadk:latest-devel'
uses: ./.github/actions/create-main-distro-alias
with:
package-name: autoware-openadk
rosdistro: ${{ needs.load-env.outputs.rosdistro }}
tag-name: latest
tag-name: latest-devel

- name: Create alias from 'autoware-openadk:{rosdistro}-latest-runtime' to 'autoware-openadk:latest-runtime'
uses: ./.github/actions/create-main-distro-alias
Expand All @@ -35,12 +35,12 @@ jobs:
rosdistro: ${{ needs.load-env.outputs.rosdistro }}
tag-name: latest-runtime

- name: Create alias from 'autoware-openadk:{rosdistro}-latest-cuda' to 'autoware-openadk:latest-cuda'
- name: Create alias from 'autoware-openadk:{rosdistro}-latest-devel-cuda' to 'autoware-openadk:latest-devel-cuda'
uses: ./.github/actions/create-main-distro-alias
with:
package-name: autoware-openadk
rosdistro: ${{ needs.load-env.outputs.rosdistro }}
tag-name: latest-cuda
tag-name: latest-devel-cuda

- name: Create alias from 'autoware-openadk:{rosdistro}-latest-runtime-cuda' to 'autoware-openadk:latest-runtime-cuda'
uses: ./.github/actions/create-main-distro-alias
Expand Down
14 changes: 13 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@ For more launch options you can edit the launch command `--launch-cmd`:
#### Using VS Code Remote Containers for Development

Get the Visual Studio Code's [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
Refer to [this document](https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user) for more details.
And reopen the workspace in the container by selecting `Remote-Containers: Reopen in Container` from the Command Palette (`F1`).

By default devcontainer assumes NIVIDA GPU support, you can change this by deleting these lines within `.devcontainer/devcontainer.json`:

```json
"hostRequirements": {
"gpu": true
},
```
```json
"--gpus", "all"
```


## Building Docker images from scratch

Expand Down
14 changes: 7 additions & 7 deletions docker/autoware-openadk/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ group "default" {
}

// For docker/metadata-action
target "docker-metadata-action-devel" {}
target "docker-metadata-action-prebuilt" {}
target "docker-metadata-action-devel" {}
target "docker-metadata-action-runtime" {}

target "devel" {
inherits = ["docker-metadata-action-devel"]
dockerfile = "docker/autoware-openadk/Dockerfile"
target = "devel"
}

target "prebuilt" {
inherits = ["docker-metadata-action-prebuilt"]
dockerfile = "docker/autoware-openadk/Dockerfile"
target = "prebuilt"
}

target "devel" {
inherits = ["docker-metadata-action-devel"]
dockerfile = "docker/autoware-openadk/Dockerfile"
target = "devel"
}

target "runtime" {
inherits = ["docker-metadata-action-runtime"]
dockerfile = "docker/autoware-openadk/Dockerfile"
Expand Down
29 changes: 24 additions & 5 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ print_help() {
echo "Options:"
echo " --help Display this help message"
echo " -h Display this help message"
echo " --map-path Specify the path to the map files (mandatory)"
echo " --no-nvidia Disable NVIDIA GPU support"
echo " --devel Use the latest development version of Autoware"
echo " --headless Run Autoware in headless mode"
echo " --headless Run Autoware in headless mode (default: false)"
echo " --workspace Specify the workspace path (default: current directory)"
echo " --map-path Specify the path to the map files (mandatory)"
echo " --launch-cmd Specify the launch command (default: autoware.launch.xml)"
echo " --launch-cmd Specify the launch command for the container"
echo ""
echo "Note: The --map-path option is mandatory. Please provide the path to the map files."
}
Expand All @@ -29,8 +29,8 @@ print_help() {
option_no_nvidia=false
option_devel=false
option_headless=false
MAP_PATH="/path/to/map"
LAUNCH_CMD="ros2 launch autoware_launch autoware.launch.xml map_path:=${MAP_PATH} vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit"
MAP_PATH=""
LAUNCH_CMD=""
WORKSPACE_PATH="${PWD}"
USER_ID=""

Expand Down Expand Up @@ -80,14 +80,28 @@ set_variables() {
USER_ID="-e LOCAL_UID=$(id -u) -e LOCAL_GID=$(id -g) -e LOCAL_USER=$(id -un) -e LOCAL_GROUP=$(id -gn)"
WORKSPACE="-v ${WORKSPACE_PATH}:/workspace"
LAUNCH_CMD=""

# Echo
echo -e "\nStarting Autoware devel container..."
echo "WORKSPACE: ${WORKSPACE_PATH}"
else
if [ "$MAP_PATH" == "" ]; then
print_help
exit 1
fi
if [ "$LAUNCH_CMD" == "" ]; then
LAUNCH_CMD="ros2 launch autoware_launch autoware.launch.xml map_path:=${MAP_PATH} vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit"
fi

MAP="-v ${MAP_PATH}:/${MAP_PATH}"
IMAGE="ghcr.io/autowarefoundation/autoware-openadk:runtime-$rosdistro-latest"
WORKSPACE=""

# Echo

echo -e "\nStarting Autoware..."
echo "MAP PATH: ${MAP_PATH}"
echo "LAUNCH CMD: ${LAUNCH_CMD}"
fi
}

Expand Down Expand Up @@ -118,6 +132,11 @@ main() {
set_x_display

# Launch Autoware with custom map
echo
echo "Executing Docker command:"
echo "docker run -it --rm --net=host ${GPU_FLAG} ${USER_ID} ${MOUNT_X} ${WORKSPACE} ${MAP} ${IMAGE} ${LAUNCH_CMD}"
echo "------------------------------------"
sleep 2
docker run -it --rm --net=host ${GPU_FLAG} ${USER_ID} ${MOUNT_X} \
${WORKSPACE} ${MAP} ${IMAGE} \
${LAUNCH_CMD}
Expand Down

0 comments on commit ed6c812

Please sign in to comment.