Dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. ARG ROS_DISTRO=galactic
  2. FROM ros:${ROS_DISTRO}-ros-base-focal
  3. ARG ROS_DISTRO=galactic
  4. ARG USERNAME=jasper
  5. ARG USER_UID=1000
  6. ARG USER_GID=$USER_UID
  7. # Create the user
  8. RUN groupadd --gid $USER_GID $USERNAME \
  9. && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
  10. #
  11. # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
  12. && sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
  13. && apt-get update \
  14. && apt-get install -y sudo \
  15. && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
  16. && chmod 0440 /etc/sudoers.d/$USERNAME \
  17. && apt-get update && apt-get upgrade -y \
  18. && apt-get install -y python3-pip
  19. ENV SHELL /bin/bash
  20. # ********************************************************
  21. # * Anything else you want to do like clean up goes here *
  22. # ********************************************************
  23. RUN echo 'source /opt/ros/galactic/setup.bash' >> /home/jasper/.bashrc \
  24. && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
  25. # [Optional] Set the default user. Omit if you want to keep the default as root.
  26. USER $USERNAME
  27. CMD ["/bin/bash"]