Skip to content

Commit f9a4859

Browse files
Hector AzpuruaHector Azpurua
authored andcommitted
fixed organization, divided dockerfiles in different archs to better
support the jetson orin nano
1 parent e9a8ba4 commit f9a4859

9 files changed

Lines changed: 63 additions & 59 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"remoteUser": "ubuntu",
66
"service": "ros1",
77
"dockerComposeFile": [
8-
"../compose_linux_host.yaml"
8+
"../compose_macos_host.yaml"
99
],
1010
"waitFor": "postCreateCommand",
1111
"workspaceFolder": "/home/ubuntu",

Dockerfile.amd64

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# syntax = edrevo/dockerfile-plus
2+
3+
FROM osrf/ros:noetic-desktop-full AS amd64_build_state
4+
5+
INCLUDE+ Dockerfile.root.common
6+
7+
# vscode server
8+
RUN curl -fOL https://github.com/coder/code-server/releases/download/v4.104.2/code-server_4.104.2_amd64.deb && \
9+
dpkg -i code-server_4.104.2_amd64.deb && \
10+
rm code-server_4.104.2_amd64.deb
11+
12+
INCLUDE+ Dockerfile.user.common

Dockerfile.arm64

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# syntax = edrevo/dockerfile-plus
2+
3+
FROM arm64v8/ros:noetic-perception-focal AS arm64_build_state
4+
5+
INCLUDE+ Dockerfile.root.common
6+
7+
# vscode server
8+
RUN curl -fOL https://github.com/coder/code-server/releases/download/v4.104.2/code-server_4.104.2_arm64.deb && \
9+
dpkg -i code-server_4.104.2_arm64.deb && \
10+
rm code-server_4.104.2_arm64.deb
11+
12+
# fix arm64 shared library for vscode and vnc services
13+
RUN wget http://ports.ubuntu.com/pool/main/libf/libffi/libffi8_3.4.2-4_arm64.deb -P /tmp && \
14+
dpkg -i /tmp/libffi8_3.4.2-4_arm64.deb;
15+
16+
INCLUDE+ Dockerfile.user.common

Dockerfile renamed to Dockerfile.root.common

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
FROM osrf/ros:noetic-desktop-full AS amd64_build_state
2-
FROM arm64v8/ros:noetic-perception-focal AS arm64_build_state
3-
FROM ${TARGETARCH}_build_state AS final_stage
4-
5-
ARG TARGETARCH
6-
ARG TARGETPLATFORM
7-
8-
LABEL architecture=$TARGETARCH
9-
101
ARG USER_UID=1000
112
ARG USER_GID=$USER_UID
123

@@ -134,19 +125,11 @@ RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main"
134125
python3-argcomplete \
135126
python3-rosdep python3-vcstool
136127

137-
# vscode
138-
RUN curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
139-
install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg && \
140-
sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' && \
141-
rm -f packages.microsoft.gpg
142-
143128
# install depending packages
144-
RUN apt-get update && apt-get upgrade -y && \
145-
apt-get install -y bash-completion \
129+
RUN apt-get install -y bash-completion \
146130
less \
147131
wget \
148132
language-pack-en \
149-
code \
150133
vim-tiny \
151134
iputils-ping \
152135
net-tools \
@@ -162,9 +145,8 @@ RUN lesspipe >> ~/.bashrc && \
162145
curl -sSL https://raw.githubusercontent.com/CoeJoder/lessfilter-pygmentize/master/.lessfilter > ~/.lessfilter && \
163146
chmod 755 ~/.lessfilter
164147

165-
# global vscode config
148+
# prepare vscode and home
166149
ADD .devcontainer/.vscode /home/ubuntu/.vscode
167-
RUN ln -s /home/ubuntu/.vscode /home/ubuntu/.vscode-server
168150
RUN sudo chown -R ubuntu:ubuntu /home/ubuntu
169151

170152
# Source ROS environment automatically
@@ -214,12 +196,6 @@ COPY configs/ros_file_templates /home/ubuntu/ros_file_templates
214196
RUN chown -R "$USERNAME:$USERNAME" "/home/ubuntu"
215197
RUN sed -i "s/password = WebUtil.getConfigVar('password');/password = '$PASSWD'/" /usr/lib/novnc/app/ui.js
216198

217-
# fix arm64 shared library for vscode and vnc services
218-
RUN if [ "$TARGETARCH" == "arm64" ]; then \
219-
wget http://ports.ubuntu.com/pool/main/libf/libffi/libffi8_3.4.2-4_arm64.deb -P /tmp && \
220-
dpkg -i /tmp/libffi8_3.4.2-4_arm64.deb; \
221-
fi
222-
223199
# prepare logger
224200
RUN mkdir -p /var/log/val_logger/noetic_devel
225201
RUN chown -R ubuntu: /var/log/val_logger/
@@ -229,28 +205,4 @@ RUN echo "blacklist ipv6" >> /etc/modprobe.d/blacklist.conf && \
229205
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf && \
230206
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf && \
231207
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf && \
232-
sysctl -p
233-
234-
# install code plugins and rosdep dependencies using the default user
235-
USER $USERNAME
236-
237-
RUN echo -e "TARGETARCH1: $TARGETARCH" >> /home/ubuntu/test.txt
238-
239-
RUN touch /home/ubuntu/.Xauthority
240-
241-
RUN echo "export PS1='[docker]\[\e[38;5;216m\]\u\[\e[38;5;160m\]@\[\e[38;5;202m\]\h \[\e[38;5;131m\]\w \[\033[0m\]$ '" >> /home/ubuntu/.bashrc
242-
243-
# TODO: add the git clone command of your repo here
244-
245-
# disable temporarily due to the lack of cache in this command
246-
# RUN code --install-extension ms-python.python && \
247-
# code --install-extension ms-vscode.cpptools-extension-pack && \
248-
# code --install-extension redhat.vscode-xml
249-
250-
RUN mkdir -p /home/ubuntu/ros_ws/src
251-
RUN chown -R ubuntu:ubuntu /home/ubuntu/
252-
253-
# RUN rosdep update
254-
255-
ENTRYPOINT [ "/entrypoint.sh" ]
256-
CMD [ "sudo", "-E", "/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
208+
sysctl -p

Dockerfile.user.common

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# install code plugins and rosdep dependencies using the default user
2+
USER $USERNAME
3+
4+
RUN touch /home/ubuntu/.Xauthority
5+
6+
RUN echo "export PS1='[docker]\[\e[38;5;216m\]\u\[\e[38;5;160m\]@\[\e[38;5;202m\]\h \[\e[38;5;131m\]\w \[\033[0m\]$ '" >> /home/ubuntu/.bashrc
7+
8+
# TODO: add the git clone command of your repo here
9+
10+
RUN mkdir -p /home/ubuntu/ros_ws/src
11+
RUN chown -R ubuntu:ubuntu /home/ubuntu/
12+
13+
# RUN rosdep update
14+
15+
ENTRYPOINT [ "/entrypoint.sh" ]
16+
CMD [ "sudo", "-E", "/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@ Open folder with VScode using the dev containers plugin (https://marketplace.vis
2727

2828
## Build directy with 'docker compose'
2929

30+
When the host is a linux-based machine:
3031
```
3132
BUILDKIT_PROGRESS=plain docker compose -f compose_linux_host.yaml up --build
3233
```
3334

35+
When the host is a macos-based machine:
36+
```
37+
BUILDKIT_PROGRESS=plain docker compose -f compose_macos_host.yaml up --build
38+
```
39+
40+
`BUILDKIT_PROGRESS=plain` helps to visualize step by step output of each of the commands.
41+
3442
## Know issues
3543

3644
- The website preview does open a terminal with a extrange cannot find shell for command XXXX.

compose_linux_host.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
container_name: ros1_noetic_devel
44
build:
55
context: .
6-
dockerfile: Dockerfile
6+
dockerfile: Dockerfile.amd64
77
ipc: host
88
pid: host
99
privileged: true
@@ -15,9 +15,8 @@ services:
1515
- ROS_LOG_DIR=/var/log/val_logger/noetic_devel
1616
- ROS_MASTER_URI=http://localhost:11311/
1717
- DEBIAN_FRONTEND=noninteractive
18-
network_mode: host
1918
volumes:
20-
- ${localWorkspaceFolder:-./local_mount}:/home/ubuntu/ros_ws
19+
- ${localWorkspaceFolder:-./}local_mount/:/home/ubuntu/ros_ws
2120
- /etc/localtime:/etc/localtime:ro
2221
- /etc/timezone:/etc/timezone:ro
2322
- /tmp/.X11-unix:/tmp/.X11-unix

compose_macos_host.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@ services:
33
container_name: ros1_noetic_devel
44
build:
55
context: .
6-
dockerfile: Dockerfile
6+
dockerfile: Dockerfile.amd64
77
ipc: host
88
pid: host
99
privileged: true
1010
network_mode: bridge
1111
ports:
1212
- "3080:3080"
13-
- "3081:3000"
13+
- "3081:3081"
1414
- "3022:3022"
1515
environment:
1616
- DISPLAY=${DISPLAY:-:0}
1717
- NVIDIA_DRIVER_CAPABILITIES=all
1818
- TZ=${TZ:-UTC}
1919
- ROS_LOG_DIR=/var/log/val_logger/noetic_devel
2020
- ROS_MASTER_URI=http://localhost:11311/
21+
- DEBIAN_FRONTEND=noninteractive
2122
volumes:
22-
- ${localWorkspaceFolder:-./local_mount}:/home/ubuntu/ros_ws
23+
- ${localWorkspaceFolder:-./}local_mount/:/home/ubuntu/ros_ws
2324
- /etc/localtime:/etc/localtime:ro
2425
- /etc/timezone:/etc/timezone:ro
2526
- /tmp/.X11-unix:/tmp/.X11-unix

configs/supervisord/code_server.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:code-server]
2-
command=code serve-web --host 0.0.0.0 --port 3081 --without-connection-token --accept-server-license-terms
2+
command=/usr/bin/code-server --auth none --disable-telemetry --disable-update-check --bind-addr 0.0.0.0:3081
33
autostart=true
44
autorestart=true
55
autostart=true

0 commit comments

Comments
 (0)