add devcontainer, dockerfile. can now run in container on opening on vscode
This commit is contained in:
parent
6a1f8139a7
commit
4b8c7faa8e
20
src/.devcontainer/devcontainer.json.jinja
Normal file
20
src/.devcontainer/devcontainer.json.jinja
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"workspaceFolder": "/home/ros2-workspace/src/{{PACKAGE_NAME}}",
|
||||
"name": "ros2-ament_cmake-devcontainer",
|
||||
"dockerComposeFile": "../docker-compose.yml",
|
||||
"service": "ros2-ament_cmake-test",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
// List of extensions to install in the dev container
|
||||
"ms-vscode.cmake-tools",
|
||||
"ms-iot.vscode-ros"
|
||||
],
|
||||
"settings": {
|
||||
// Additional settings for the dev container
|
||||
}
|
||||
}
|
||||
},
|
||||
"forwardPorts": [
|
||||
]
|
||||
}
|
33
src/Dockerfile.jinja
Normal file
33
src/Dockerfile.jinja
Normal file
@ -0,0 +1,33 @@
|
||||
FROM ros:jazzy-ros-core
|
||||
ENV ROS_DISTRO=jazzy
|
||||
ENV WS=/home/ros2-workspace
|
||||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y ros-${ROS_DISTRO}-mavros \
|
||||
ros-${ROS_DISTRO}-mavros-extras \
|
||||
ros-${ROS_DISTRO}-mavros-msgs \
|
||||
python3-colcon-common-extensions \
|
||||
ros-dev-tools \
|
||||
build-essential \
|
||||
ros-${ROS_DISTRO}-tf-transformations \
|
||||
make
|
||||
|
||||
RUN wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh
|
||||
RUN bash ./install_geographiclib_datasets.sh
|
||||
|
||||
|
||||
WORKDIR ${WS}/src
|
||||
COPY . ./{{PACKAGE_NAME}}
|
||||
|
||||
#Don't forget to set a healthcheck for your container!
|
||||
{{HEALTHCHECK}}
|
||||
# Command to run your application
|
||||
#CMD [{{RUN_COMMAND}}] --wait --screen
|
||||
RUN /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; colcon build;"
|
||||
|
||||
RUN apt-get clean
|
||||
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
|
||||
RUN echo "source ${WS}/src/install/setup.bash" >> ~/.bashrc
|
||||
|
||||
#FIX ME
|
||||
ENTRYPOINT ["/bin/bash","-c","source ${WS}/src/install/setup.bash && {{RUN_COMMAND}}"]
|
33
src/docker-compose.yml.jinja
Normal file
33
src/docker-compose.yml.jinja
Normal file
@ -0,0 +1,33 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
ros2-ament_cmake-test:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- ./:/home/ros2-workspace/src/{{PACKAGE_NAME}}
|
||||
command: bash -c "tail -f /dev/null"
|
||||
stdin_open: true
|
||||
tty: true
|
||||
restart: always
|
||||
networks:
|
||||
- sdk
|
||||
- default
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 1024
|
||||
hard: 524288
|
||||
{% if ENABLE_NVIDIA_GPU %}
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: cdi
|
||||
device_ids:
|
||||
- nvidia.com/gpu=all
|
||||
{% endif %}
|
||||
networks:
|
||||
sdk:
|
||||
name: spiri-sdk_default
|
||||
external: true
|
Loading…
Reference in New Issue
Block a user