-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (38 loc) · 1.6 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ARG ROS_DISTRO=humble
FROM ros:${ROS_DISTRO}-ros-base-jammy
ARG ROS_DISTRO=humble
# Set JETSON=true when building for Jetson (ARM64 + CUDA via JetPack).
# The default installs CPU-only PyTorch for x86 CI/dev; it will not use the
# Jetson GPU and will fail on ARM if pulled from the whl/cpu index.
ARG JETSON=false
ARG TORCH_INSTALL="torch torchvision --index-url https://download.pytorch.org/whl/cpu"
ARG INSTALL_ULTRALYTICS=true
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
ROS_DISTRO=${ROS_DISTRO}
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-colcon-common-extensions \
python3-pip \
python3-opencv \
ros-${ROS_DISTRO}-cv-bridge \
ros-${ROS_DISTRO}-diagnostic-msgs \
ros-${ROS_DISTRO}-vision-msgs \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& if [ "${JETSON}" = "true" ]; then \
python3 -m pip install --no-cache-dir torch torchvision \
--index-url https://developer.download.nvidia.com/compute/redist/jp/v512/pytorch/; \
else \
python3 -m pip install --no-cache-dir ${TORCH_INSTALL}; \
fi \
&& if [ "${INSTALL_ULTRALYTICS}" = "true" ]; then \
python3 -m pip install --no-cache-dir ultralytics; \
fi
WORKDIR /ros2_ws/src/jetson_ready_ros2_object_detection
COPY . .
WORKDIR /ros2_ws
RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" && colcon build --symlink-install
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["ros2", "launch", "jetson_ready_ros2_object_detection", "object_detection.launch.py"]