-
Notifications
You must be signed in to change notification settings - Fork 0
/
brash.Dockerfile
184 lines (146 loc) · 5.17 KB
/
brash.Dockerfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
################################################
# Build ros-base #
# (ROS2 image with default packages) #
################################################
FROM osrf/ros:humble-desktop AS ros-base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
# Needed for OpenGL fix for Rviz to display
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:kisak/kisak-mesa \
&& apt update \
&& apt -y upgrade \
&& apt-get install -y \
python3-pip \
libnlopt-dev \
libnlopt-cxx-dev \
# Note: ros-humble-desktop is needed for ARM base image, but is already available for nominal -desktop image
ros-humble-desktop \
ros-humble-xacro \
ros-humble-joint-state-publisher \
ros-humble-srdfdom \
ros-humble-rqt* \
ros-humble-ament-cmake-test \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install cfdp
# Switch to bash shell
SHELL ["/bin/bash", "-c"]
# Create a brash user
ENV USERNAME=brash_user
ENV HOME_DIR=/home/${USERNAME}
ENV CODE_DIR=/code
# Dev container arguments
ARG USER_UID=1000
ARG USER_GID=${USER_UID}
# Create new user and home directory
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} --create-home ${USERNAME} \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME} \
&& mkdir -p ${CODE_DIR} \
&& chown -R ${USER_UID}:${USER_GID} ${CODE_DIR}
USER ${USERNAME}
WORKDIR ${CODE_DIR}
################################################
# Build rosgsw-dev #
################################################
FROM ros-base AS rosgsw-dev
ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update && sudo apt-get install -y \
libnlopt-dev \
libnlopt-cxx-dev \
ros-humble-xacro \
ros-humble-joint-state-publisher \
ros-humble-srdfdom \
ros-humble-joint-state-publisher-gui \
ros-humble-geometric-shapes \
ros-humble-rqt-robot-steering \
ros-humble-rqt* \
libdwarf-dev \
libelf-dev \
libsqlite3-dev \
sqlitebrowser \
&& sudo rm -rf /var/lib/apt/lists/*
# Set up sourcing
COPY --chown=${USERNAME}:${USERNAME} config/rosgsw_entrypoint.sh ${CODE_DIR}/entrypoint.sh
RUN echo 'source ${CODE_DIR}/entrypoint.sh' >> ~/.bashrc
# Get ready with brash workspace
RUN mkdir -p ${CODE_DIR}/brash
WORKDIR ${CODE_DIR}/brash
################################################
# Build rosfsw-dev #
################################################
FROM rosgsw-dev AS rosfsw-dev
ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update && sudo apt-get install -y \
ros-humble-controller-interface \
ros-humble-realtime-tools \
ros-humble-control-toolbox \
ros-humble-geometric-shapes \
ros-humble-controller-manager \
ros-humble-joint-trajectory-controller \
ros-humble-rqt* \
ignition-fortress \
ros-humble-ros-gz-sim \
ros-humble-ros-gz-bridge \
ros-humble-robot-localization \
ros-humble-interactive-marker-twist-server \
ros-humble-twist-mux \
ros-humble-joy-linux \
ros-humble-imu-tools \
ros-humble-ign-ros2-control \
ros-humble-joint-state-broadcaster \
ros-humble-diff-drive-controller \
ros-humble-clearpath-gz \
&& sudo rm -rf /var/lib/apt/lists/*
# Build a rover_ws into container
WORKDIR ${CODE_DIR}
RUN mkdir -p ${CODE_DIR}/rover_ws
WORKDIR ${CODE_DIR}/rover_ws
# Copy rover repos and robot config file required
COPY --chown=${USERNAME}:${USERNAME} ./config/rover.repos rover.repos
RUN mkdir src && vcs import src < rover.repos
# Copy the sample rover yaml to top workspace
# https://docs.clearpathrobotics.com/docs/ros/tutorials/simulator/install/
RUN cp src/clearpath_config/clearpath_config/sample/w200/w200_default.yaml robot.yaml
# Build the rover workspace
RUN source /opt/ros/humble/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# Set up sourcing
COPY --chown=${USERNAME}:${USERNAME} ./config/rosfsw_entrypoint.sh ${CODE_DIR}/entrypoint.sh
# Not needed, line in bashrc was added in building of rosgsw-dev
#RUN echo 'source ${CODE_DIR}/entrypoint.sh' >> ~/.bashrc
# Source from rover_ws
WORKDIR ${CODE_DIR}/brash
##################################################
# Build rosgsw (Production)
##################################################
FROM rosgsw-dev AS rosgsw
# Copy brash=
COPY --chown=${USERNAME}:${USERNAME} brash ${CODE_DIR}/brash
# Build the brash workspace
WORKDIR ${CODE_DIR}/brash
RUN source /opt/ros/humble/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# Build juicer
#COPY --chown=${USERNAME}:${USERNAME} juicer ${CODE_DIR}/juicer
#WORKDIR ${CODE_DIR}/juicer
#RUN make
# Set workspace
WORKDIR ${CODE_DIR}/brash
##################################################
# Build rosfsw (Production)
##################################################
FROM rosfsw-dev AS rosfsw
# Copy brash
COPY --chown=${USERNAME}:${USERNAME} brash ${CODE_DIR}/brash
# Build the brash workspace
WORKDIR ${CODE_DIR}/brash
RUN source ${CODE_DIR}/rover_ws/install/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# Build juicer
#COPY --chown=${USERNAME}:${USERNAME} juicer ${CODE_DIR}/juicer
#WORKDIR ${CODE_DIR}/juicer
#RUN make
# Set workspace
WORKDIR ${CODE_DIR}/brash