Simulator: fix port issues in devcontainer (#29977)

* fix sim devcontainer

* use host.docker.internal instead

* devcontainer supports jsonc
This commit is contained in:
Justin Newberry 2023-09-20 16:34:29 -07:00 committed by GitHub
parent feeb827369
commit 1f8ceb4ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 2 deletions

View File

@ -9,3 +9,5 @@ RUN pip install ipython jupyter jupyterlab
RUN cd $HOME && \
curl -O https://raw.githubusercontent.com/commaai/agnos-builder/master/userspace/home/.tmux.conf && \
curl -O https://github.com/commaai/agnos-builder/blob/master/userspace/home/.vimrc
ENV CARLA_HOST="host.docker.internal"

View File

@ -18,7 +18,8 @@
"--volume=${localEnv:HOME}/.comma:/root/.comma",
"--volume=/tmp/comma_download_cache:/tmp/comma_download_cache",
"--volume=/tmp/devcontainer_scons_cache:/tmp/scons_cache",
"--shm-size=1G"
"--shm-size=1G",
"--add-host=host.docker.internal:host-gateway" // required to use host.docker.internal on linux
],
"customizations": {
"vscode": {

View File

@ -10,6 +10,7 @@ repos:
- id: check-ast
exclude: '^(third_party)/'
- id: check-json
exclude: '.devcontainer/devcontainer.json' # this supports JSON with comments
- id: check-toml
- id: check-xml
- id: check-yaml

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python
import argparse
import os
from typing import Any
from multiprocessing import Queue
@ -19,7 +20,7 @@ def parse_args(add_args=None):
# Carla specific
parser.add_argument('--town', type=str, default='Town04_Opt')
parser.add_argument('--spawn_point', dest='num_selected_spawn_point', type=int, default=16)
parser.add_argument('--host', dest='host', type=str, default='127.0.0.1')
parser.add_argument('--host', dest='host', type=str, default=os.environ.get("CARLA_HOST", '127.0.0.1'))
parser.add_argument('--port', dest='port', type=int, default=2000)
return parser.parse_args(add_args)