File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Base Image : https://hub.docker.com/r/osrf/ros/tags?page=1&name=humble
2
- FROM osrf/ros:humble-desktop-full
2
+ FROM osrf/ros:humble-desktop-full AS amd64
3
+ # Base Image : https://hub.docker.com/r/arm64v8/ros/tags?page=1&name=humble
4
+ FROM arm64v8/ros:humble AS arm64
5
+
6
+ # Use docker automatic platform args to select the base image.
7
+ # It may be `arm64` or `amd64` depending on the platform.
8
+ # Ref: https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope
9
+ FROM $TARGETARCH
3
10
4
11
# Arguments for the default user
5
12
ARG USERNAME=user
@@ -49,10 +56,17 @@ RUN --mount=type=cache,target=/var/cache/apt \
49
56
git-extras \
50
57
&& rm -rf /var/lib/apt/lists/*
51
58
52
- # Install ROS2 RVIZ and Gazebo
59
+ # Install ROS2 Gazebo packages for amd64
60
+ RUN if [ "$TARGETARCH" = "amd64" ]; then \
61
+ apt-get update && apt-get install -y \
62
+ ros-$ROS_DISTRO-gazebo-ros-pkgs \
63
+ ros-$ROS_DISTRO-gazebo-ros2-control \
64
+ && rm -rf /var/lib/apt/lists/*; \
65
+ fi
66
+
67
+ # Install ROS2 RVIZ and other custom ROS2 packages
53
68
RUN --mount=type=cache,target=/var/cache/apt \
54
69
apt-get update && apt-get install -y \
55
- ros-$ROS_DISTRO-gazebo-ros-pkgs \
56
70
ros-$ROS_DISTRO-rviz2 \
57
71
&& rm -rf /var/lib/apt/lists/*
58
72
Original file line number Diff line number Diff line change 1
1
services :
2
2
template-ws :
3
- build : .
3
+ build :
4
+ context : .
5
+ dockerfile : Dockerfile
6
+ # Specify the target platform to build the image, otherwise it will build for the host platform.
7
+ # Reference: https://docs.docker.com/compose/compose-file/build/#platforms
8
+ # platforms:
9
+ # - "linux/arm64"
4
10
image : j3soon/ros2-template-ws
5
11
container_name : ros2-template-ws
6
12
stdin_open : true
You can’t perform that action at this time.
0 commit comments