Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docker): mount autoware_data in container #5831

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ option_no_nvidia=false
option_devel=false
option_headless=false
MAP_PATH=""
DATA_PATH=""
WORKSPACE_PATH=""
USER_ID=""
WORKSPACE=""
Expand All @@ -36,6 +37,7 @@ print_help() {
echo -e "Options:"
echo -e " ${GREEN}--help/-h${NC} Display this help message"
echo -e " ${GREEN}--map-path${NC} Specify to mount map files into /autoware_map (mandatory for runtime)"
echo -e " ${GREEN}--data-path${NC} Specify to mount data files into /root/autoware_data (mandatory for runtime)"
echo -e " ${GREEN}--devel${NC} Launch the latest Autoware development environment with shell access"
echo -e " ${GREEN}--workspace${NC} (--devel only)Specify the directory to mount into /workspace, by default it uses current directory (pwd)"
echo -e " ${GREEN}--no-nvidia${NC} Disable NVIDIA GPU support"
Expand Down Expand Up @@ -68,6 +70,10 @@ parse_arguments() {
MAP_PATH="$2"
shift
;;
--data-path)
DATA_PATH="$2"
shift
;;
--*)
echo "Unknown option: $1"
print_help
Expand Down Expand Up @@ -107,6 +113,11 @@ set_variables() {
MAP="-v ${MAP_PATH}:/autoware_map:ro"
fi

# Set data path
if [ "$DATA_PATH" != "" ]; then
DATA="-v ${DATA_PATH}:/root/autoware_data:rw"
fi

# Set launch command
if [ "$LAUNCH_CMD" = "" ]; then
LAUNCH_CMD="/bin/bash"
Expand All @@ -116,13 +127,14 @@ set_variables() {
IMAGE="ghcr.io/autowarefoundation/autoware:universe"

# Set map path
if [ "$MAP_PATH" = "" ]; then
if [ "$MAP_PATH" = "" ] || [ "$DATA_PATH" = "" ]; then
echo -e "\n------------------------------------------------------------"
echo -e "${RED}Note:${NC} The --map-path option is mandatory for the universe(runtime image). For development environment with shell access, use --devel option."
echo -e "${RED}Note:${NC} The --map-path and --data-path option is mandatory for the universe(runtime image). For development environment with shell access, use --devel option."
echo -e "------------------------------------------------------------"
exit 1
else
MAP="-v ${MAP_PATH}:/autoware_map:ro"
DATA="-v ${DATA_PATH}:/root/autoware_data:rw"
fi

# Set default launch command if not provided
Expand Down Expand Up @@ -180,7 +192,7 @@ main() {
set -x
docker run -it --rm --net=host ${GPU_FLAG} ${USER_ID} ${MOUNT_X} \
-e XAUTHORITY=${XAUTHORITY} -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e NVIDIA_DRIVER_CAPABILITIES=all -v /etc/localtime:/etc/localtime:ro \
${WORKSPACE} ${MAP} ${IMAGE} \
${WORKSPACE} ${MAP} ${DATA} ${IMAGE} \
${LAUNCH_CMD}
}

Expand Down
Loading