Skip to content

Commit

Permalink
shorten compile time and add bashrc
Browse files Browse the repository at this point in the history
  • Loading branch information
woensug-choi committed Jun 5, 2024
1 parent 2618973 commit 5f8e963
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 67 deletions.
1 change: 1 addition & 0 deletions .docker/jazzy.amd64.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ RUN touch /ros_entrypoint.sh && sed --in-place --expression \

# Set User as user
USER $USER
RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc
148 changes: 81 additions & 67 deletions .docker/jazzy.arm64v8.dockerfile
Original file line number Diff line number Diff line change
@@ -1,73 +1,88 @@
FROM arm64v8/ubuntu:24.04
# Set RDP and SSH environments
ARG X11Forwarding=true
# hadolint ignore=DL3008,DL3015,DL3009
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y ubuntu-desktop-minimal=1.539 dbus-x11 xrdp sudo; \
[ $X11Forwarding = 'true' ] && apt-get install -y openssh-server; \
apt-get autoremove --purge; \
apt-get clean; \
rm /run/reboot-required*

ARG USER=docker
ARG PASS=docker

RUN useradd -s /bin/bash -m $USER -p "$(openssl passwd "$PASS")"; \
usermod -aG sudo $USER; echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers; \
adduser xrdp ssl-cert; \
# Setting the required environment variables
echo 'LANG=en_US.UTF-8' >> /etc/default/locale; \
echo 'export GNOME_SHELL_SESSION_MODE=ubuntu' > /home/$USER/.xsessionrc; \
echo 'export XDG_CURRENT_DESKTOP=ubuntu:GNOME' >> /home/$USER/.xsessionrc; \
echo 'export XDG_SESSION_TYPE=x11' >> /home/$USER/.xsessionrc; \
# Enabling log to the stdout
sed -i "s/#EnableConsole=false/EnableConsole=true/g" /etc/xrdp/xrdp.ini; \
# Disabling system animations and reducing the
# image quality to improve the performance
sed -i 's/max_bpp=32/max_bpp=16/g' /etc/xrdp/xrdp.ini; \
gsettings set org.gnome.desktop.interface enable-animations true; \
# Listening on wildcard address for X forwarding
[ $X11Forwarding = 'true' ] && \
sed -i 's/#X11UseLocalhost yes/X11UseLocalhost no/g' /etc/ssh/sshd_config || \
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config || \
:;

# Disable initial welcome window
RUN echo "X-GNOME-Autostart-enabled=false" >> /etc/xdg/autostart/gnome-initial-setup-first-login.desktop

# Run
EXPOSE 3389/tcp
EXPOSE 22/tcp
# hadolint ignore=DL3025
CMD sudo rm -f /var/run/xrdp/xrdp*.pid >/dev/null 2>&1; \
sudo service dbus restart >/dev/null 2>&1; \
sudo /usr/lib/systemd/systemd-logind >/dev/null 2>&1 & \
[ -f /usr/sbin/sshd ] && sudo /usr/sbin/sshd; \
sudo xrdp-sesman --config /etc/xrdp/sesman.ini; \
sudo xrdp --nodaemon --config /etc/xrdp/xrdp.ini
# FROM arm64v8/ubuntu:24.04
# # Set RDP and SSH environments
# ARG X11Forwarding=true
# # hadolint ignore=DL3008,DL3015,DL3009
# RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
# apt-get install -y ubuntu-desktop-minimal dbus-x11 xrdp sudo; \
# [ $X11Forwarding = 'true' ] && apt-get install -y openssh-server; \
# apt-get autoremove --purge; \
# apt-get clean; \
# rm /run/reboot-required*

# ARG USER=docker
# ARG PASS=docker

# RUN useradd -s /bin/bash -m $USER -p "$(openssl passwd "$PASS")"; \
# usermod -aG sudo $USER; echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers; \
# adduser xrdp ssl-cert; \
# # Setting the required environment variables
# echo 'LANG=en_US.UTF-8' >> /etc/default/locale; \
# echo 'export GNOME_SHELL_SESSION_MODE=ubuntu' > /home/$USER/.xsessionrc; \
# echo 'export XDG_CURRENT_DESKTOP=ubuntu:GNOME' >> /home/$USER/.xsessionrc; \
# echo 'export XDG_SESSION_TYPE=x11' >> /home/$USER/.xsessionrc; \
# # Enabling log to the stdout
# sed -i "s/#EnableConsole=false/EnableConsole=true/g" /etc/xrdp/xrdp.ini; \
# # Disabling system animations and reducing the
# # image quality to improve the performance
# sed -i 's/max_bpp=32/max_bpp=16/g' /etc/xrdp/xrdp.ini; \
# gsettings set org.gnome.desktop.interface enable-animations true; \
# # Listening on wildcard address for X forwarding
# [ $X11Forwarding = 'true' ] && \
# sed -i 's/#X11UseLocalhost yes/X11UseLocalhost no/g' /etc/ssh/sshd_config || \
# sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config || \
# :;

# # Disable initial welcome window
# RUN echo "X-GNOME-Autostart-enabled=false" >> /etc/xdg/autostart/gnome-initial-setup-first-login.desktop

# # Install basics
# ENV DEBIAN_FRONTEND noninteractive
# ENV DEBCONF_NONINTERACTIVE_SEEN=true
# # hadolint ignore=DL3008
# RUN apt-get update && \
# apt-get install -y --no-install-recommends \
# sudo xterm init systemd snapd vim net-tools \
# curl wget git build-essential cmake cppcheck \
# gnupg libeigen3-dev libgles2-mesa-dev \
# lsb-release pkg-config protobuf-compiler \
# python3-dbg python3-pip python3-venv \
# qtbase5-dev ruby dirmngr gnupg2 nano xauth \
# software-properties-common htop libtool \
# x11-apps mesa-utils bison flex automake && \
# rm -rf /var/lib/apt/lists/

# Locale for UTF-8
# RUN truncate -s0 /tmp/preseed.cfg && \
# (echo "tzdata tzdata/Areas select Etc" >> /tmp/preseed.cfg) && \
# (echo "tzdata tzdata/Zones/Etc select UTC" >> /tmp/preseed.cfg) && \
# debconf-set-selections /tmp/preseed.cfg && \
# rm -f /etc/timezone && \
# dpkg-reconfigure -f noninteractive tzdata
# # hadolint ignore=DL3008
# RUN apt-get update && \
# apt-get -y install --no-install-recommends locales tzdata \
# && rm -rf /tmp/*
# RUN locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
# export LANG=en_US.UTF-8

# # Run
# EXPOSE 3389/tcp
# EXPOSE 22/tcp
# # hadolint ignore=DL3025
# CMD sudo rm -f /var/run/xrdp/xrdp*.pid >/dev/null 2>&1; \
# sudo service dbus restart >/dev/null 2>&1; \
# sudo /usr/lib/systemd/systemd-logind >/dev/null 2>&1 & \
# [ -f /usr/sbin/sshd ] && sudo /usr/sbin/sshd; \
# sudo xrdp-sesman --config /etc/xrdp/sesman.ini; \
# sudo xrdp --nodaemon --config /etc/xrdp/xrdp.ini

# hadolint ignore=DL3007
FROM woensugchoi/ubuntu-arm-rdp-base:latest

# ROS-Gazebo arg
ARG BRANCH="ros2"
ARG ROS_DISTRO="jazzy"

# Install basics
USER root
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo xterm init systemd snapd vim net-tools \
curl wget git build-essential cmake cppcheck \
gnupg libeigen3-dev libgles2-mesa-dev \
lsb-release pkg-config protobuf-compiler \
python3-dbg python3-pip python3-venv \
qtbase5-dev ruby dirmngr gnupg2 nano xauth \
software-properties-common htop libtool \
x11-apps mesa-utils bison flex automake && \
rm -rf /var/lib/apt/lists/

# Locale for UTF-8
RUN truncate -s0 /tmp/preseed.cfg && \
(echo "tzdata tzdata/Areas select Etc" >> /tmp/preseed.cfg) && \
Expand Down Expand Up @@ -113,9 +128,8 @@ RUN touch /ros_entrypoint.sh && sed --in-place --expression \

# Set User as user
USER docker

# Set volume previleage for HOST home directory
RUN echo "chown docker:docker ~/HOST" >> ~/.bashrc
RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc && \
echo "chown docker:docker ~/HOST" >> ~/.bashrc

# Use software rendering for container
ENV LIBGL_ALWAYS_INDIRECT=1

0 comments on commit 5f8e963

Please sign in to comment.