Packaging with Docker
For many common use cases, Artefacts runs automatically on the service cloud simulation infrastructure, provided a valid artefacts.yaml
configuration file. Please refer to cloud-simulation for more details.
Artefacts also supports custom Docker configuration files. This guide explains the condition for running smoothly on Artefacts.
When to use a custom Dockerfile or image name
When running on Artefacts cloud simulation, you currently need to specify a custom Dockerfile
or image in the following situations:
- Not using ROS
- Not using a supported ROS version (list upcoming, but supporting the past 2-3 years at this point)
- You are using an unsupported simulator
- Your project has some specific requirements
my-job:
type: test
package:
docker:
build: # Sample with a custom Dockerfile. Another option is to specify an image.
dockerfile: ./Dockerfile
Artefacts Base Images
We have prepared a number of images which you are freely welcome to use as a base layer of your ROS1 and ROS2 projects. These base images contain:
- The tag's corresponding ROS version (e.g.
noetic-gazebo11
contains theros-noetic-ros-core
package) - The tag's corresponding simulator
- Commonly used ROS dependencies for that ROS/simulator combination (such as
ros-galactic-ros-ign-bridge
in our ROS2 Galactic / Fortress base image) - Necessary build tools (
catkin
/colcon
) - Initializes and updates
rosdep
- The artefacts CLI
The following ROS / simulator combinations are currently available:
- ROS1 Noetic and Gazebo 11 (Classic)
- ROS2 Galactic and Gazebo (Ignition) Fortress
and are publicly available on Amazon ECR:
public.ecr.aws/artefacts/ros1:noetic-gazebo11
(amd64
andarm64
)public.ecr.aws/artefacts/ros1:noetic-gazebo11-gpu
(amd64
only)public.ecr.aws/artefacts/ros1:noetic-turtlesim
(amd64
andarm64
)public.ecr.aws/artefacts/ros2:galactic-fortress
(amd64
andarm64
)public.ecr.aws/artefacts/ros2:galactic-fortress-gpu
(amd64
only)public.ecr.aws/artefacts/ros2:galactic-turtlesim
(amd64
andarm64
)public.ecr.aws/artefacts/ros2-humble-fortress
(amd64
andarm64
)public.ecr.aws/artefacts/ros2:humble-fortress-gpu
(amd64
only)public.ecr.aws/artefacts/ros2:humble-turtlesim
(amd64
andarm64
)
By using these base images, your project Dockerfile will then need to perform (as a minimum) the following steps:
- Copy over your project files
- Install your ROS dependencies
- Build your project
- Run the artefacts client
As an example, a ROS2 Galactic / Ignition Fortress project's Dockerfile could look like the following to work with artefacts:
# Use the artefacts ROS2 galactic base image
FROM public.ecr.aws/artefacts/ros2:galactic-fortress
# Set the working directory and copy our project
WORKDIR /ws
COPY . /ws/src
# ROS dependencies
RUN rosdep install --from-paths src --ignore-src -r -y
# Source ROS version and build
RUN . /opt/ros/galactic/setup.sh && colcon build --symlink-install
WORKDIR /ws/src
# Source colcon workspace and run the artefacts client
CMD . /ws/install/setup.sh && artefacts run $ARTEFACTS_JOB_NAME
Note: The gpu
enabled images are specifically designed to run on the artefacts infrastructure, and with NVIDIA gpus. As a result they do not require any additional environment variables to be set when running on artefacts cloud simulation.
If you are running locally, you may need to install the NVIDIA Container Toolkit, and set some environment variables ('ENV'). See NVIDIA's installation guide and user guide for more details.
Dockerfile requirements
The docker file must currently comply to 2 requirements:
- it must install the CLI (already installed in artefacts provided base images)
RUN pip install artefacts-cli
- the container launch command must run the CLI:
CMD artefacts run $ARTEFACTS_JOB_NAME