diff --git a/src/.devcontainer/devcontainer.json.jinja b/src/.devcontainer/devcontainer.json.jinja new file mode 100644 index 0000000..95169a1 --- /dev/null +++ b/src/.devcontainer/devcontainer.json.jinja @@ -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": [ + ] +} diff --git a/src/Dockerfile.jinja b/src/Dockerfile.jinja new file mode 100644 index 0000000..5201f79 --- /dev/null +++ b/src/Dockerfile.jinja @@ -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}}"] \ No newline at end of file diff --git a/src/docker-compose.yml.jinja b/src/docker-compose.yml.jinja new file mode 100644 index 0000000..33c8819 --- /dev/null +++ b/src/docker-compose.yml.jinja @@ -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