Forráskód Böngészése

feat: add more dockerfile

lujw2 8 hónapja
szülő
commit
b67fbad6a3
6 módosított fájl, 179 hozzáadás és 34 törlés
  1. 0 31
      Dockerfile
  2. 34 0
      cuda11.4-ros-melodic.Dockerfile
  3. 62 3
      docker-compose.yml
  4. 28 0
      ros-melodic.Dockerfile
  5. 28 0
      ros-neotic.Dockerfile
  6. 27 0
      ros2-galactic.Dockerfile

+ 0 - 31
Dockerfile

@@ -1,31 +0,0 @@
-ARG ROS_DISTRO=galactic
-FROM ros:${ROS_DISTRO}-ros-base-focal
-
-ARG ROS_DISTRO=galactic
-ARG USERNAME=jasper
-ARG USER_UID=1000
-ARG USER_GID=$USER_UID
-
-# Create the user
-RUN groupadd --gid $USER_GID $USERNAME \
-    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
-    #
-    # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
-    && sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
-    && apt-get update \
-    && apt-get install -y sudo \
-    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
-    && chmod 0440 /etc/sudoers.d/$USERNAME \
-    && apt-get update && apt-get upgrade -y \
-    && apt-get install -y python3-pip
-ENV SHELL /bin/bash
-
-# ********************************************************
-# * Anything else you want to do like clean up goes here *
-# ********************************************************
-RUN echo 'source /opt/ros/galactic/setup.bash' >> /home/jasper/.bashrc \
-    && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
-
-# [Optional] Set the default user. Omit if you want to keep the default as root.
-USER $USERNAME
-CMD ["/bin/bash"]

+ 34 - 0
cuda11.4-ros-melodic.Dockerfile

@@ -0,0 +1,34 @@
+FROM nvidia/cuda:11.4.3-devel-ubuntu18.04
+
+ARG ROS_DISTRO=melodic
+
+# Setup user account
+ARG uid=1000
+ARG gid=1000
+ARG user=jasper
+RUN groupadd -r -f -g ${gid} ${user} && useradd -o -r -l -u ${uid} -g ${gid} -ms /bin/bash ${user}
+RUN usermod -aG sudo ${user}
+RUN echo "${user}:888888" | chpasswd
+
+ENV DEBIAN_FRONTEND=noninteractive
+    # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
+RUN sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
+    && apt-get update && apt-get install -y --no-install-recommends sudo \
+    libc-bin \
+    binutils \
+    lsb-release \
+    curl
+
+RUN sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' \
+    && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - \
+    && apt-get update && apt-get install -y --no-install-recommends ros-melodic-desktop-full
+
+# ********************************************************
+# * Anything else you want to do like clean up goes here *
+# ********************************************************
+RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/jasper/.bashrc \
+    && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
+
+# [Optional] Set the default user. Omit if you want to keep the default as root.
+USER $user
+CMD ["/bin/bash"]

+ 62 - 3
docker-compose.yml

@@ -1,10 +1,17 @@
 version: '3'
 services:
-  ros_dev:
-    image: ros_dev:v1.0
-    container_name: ros_dev
+  ros2-galactic-dev:
+    image: ros2-galactic-dev:v1.0
+    container_name: ros2-galactic-dev
     privileged: true
     stdin_open: true
+    deploy:
+      resources:
+        reservations:
+          devices:
+            - driver: nvidia
+              count: 1
+              capabilities: [gpu]
     tty: true
     environment:
         DISPLAY: $DISPLAY
@@ -19,3 +26,55 @@ services:
       # Work
       - /dev:/dev
       - /home/jasper/Work/Robot/:/home/jasper/Work/Robot/
+
+  ros-melodic-dev:
+    image: cuda11.4-ros-melodic:v0.1
+    container_name: cuda-ros-melodic
+    privileged: true
+    stdin_open: true
+    tty: true
+    deploy:
+      resources:
+        reservations:
+          devices:
+            - driver: nvidia
+              count: 1
+              capabilities: [gpu]
+    environment:
+        DISPLAY: $DISPLAY
+    volumes:
+      - /tmp/.X11-unix:/tmp/.X11-unix
+      # nvim and some tools
+      - /home/jasper/.config/:/home/jasper/.config/
+      - /home/jasper/.local/share/nvim:/home/jasper/.local/share/nvim
+      - /home/jasper/.local/state/nvim:/home/jasper/.local/state/nvim
+      - /home/jasper/Software:/home/jasper/Software
+      # Work
+      - /dev:/dev
+      - /home/jasper/Work/Robot/:/home/jasper/Work/Robot/
+
+  # ros-melodic-dev2:
+  #   image: nvidia/cuda:11.4.3-devel-ubuntu18.04
+  #   container_name: ros-melodic-dev
+  #   privileged: true
+  #   stdin_open: true
+  #   tty: true
+  #   deploy:
+  #     resources:
+  #       reservations:
+  #         devices:
+  #           - driver: nvidia
+  #             count: 1
+  #             capabilities: [gpu]
+  #   environment:
+  #       DISPLAY: $DISPLAY
+  #   volumes:
+  #     - /tmp/.X11-unix:/tmp/.X11-unix
+  #     # nvim and some tools
+  #     - /home/jasper/.config/:/home/jasper/.config/
+  #     - /home/jasper/.local/share/nvim:/home/jasper/.local/share/nvim
+  #     - /home/jasper/.local/state/nvim:/home/jasper/.local/state/nvim
+  #     - /home/jasper/Software:/home/jasper/Software
+  #     # Work
+  #     - /dev:/dev
+  #     - /home/jasper/Work/Robot/:/home/jasper/Work/Robot/

+ 28 - 0
ros-melodic.Dockerfile

@@ -0,0 +1,28 @@
+FROM ros:melodic-robot
+
+ARG ROS_DISTRO=melodic
+
+# Setup user account
+ARG uid=1000
+ARG gid=1000
+ARG user=jasper
+RUN groupadd -r -f -g ${gid} ${user} && useradd -o -r -l -u ${uid} -g ${gid} -ms /bin/bash ${user}
+RUN usermod -aG sudo ${user}
+RUN echo "${user}:888888" | chpasswd
+
+ENV DEBIAN_FRONTEND=noninteractive
+    # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
+RUN sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
+    && apt-get update && apt-get install -y --no-install-recommends sudo \
+    libc-bin \
+    binutils
+
+# ********************************************************
+# * Anything else you want to do like clean up goes here *
+# ********************************************************
+RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/jasper/.bashrc \
+    && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
+
+# [Optional] Set the default user. Omit if you want to keep the default as root.
+USER $user
+CMD ["/bin/bash"]

+ 28 - 0
ros-neotic.Dockerfile

@@ -0,0 +1,28 @@
+FROM ros:neotic-robot
+
+ARG ROS_DISTRO=neotic
+
+# Setup user account
+ARG uid=1000
+ARG gid=1000
+ARG user=jasper
+RUN groupadd -r -f -g ${gid} ${user} && useradd -o -r -l -u ${uid} -g ${gid} -ms /bin/bash ${user}
+RUN usermod -aG sudo ${user}
+RUN echo "${user}:888888" | chpasswd
+
+ENV DEBIAN_FRONTEND=noninteractive
+    # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
+RUN sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
+    && apt-get update && apt-get install -y --no-install-recommends sudo \
+    libc-bin \
+    binutils
+
+# ********************************************************
+# * Anything else you want to do like clean up goes here *
+# ********************************************************
+RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/jasper/.bashrc \
+    && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
+
+# [Optional] Set the default user. Omit if you want to keep the default as root.
+USER $user
+CMD ["/bin/bash"]

+ 27 - 0
ros2-galactic.Dockerfile

@@ -0,0 +1,27 @@
+FROM ros:galactic-ros-base-focal
+
+ARG ROS_DISTRO=galactic
+
+# Setup user account
+ARG uid=1000
+ARG gid=1000
+ARG user=jasper
+RUN groupadd -r -f -g ${gid} ${user} && useradd -o -r -l -u ${uid} -g ${gid} -ms /bin/bash ${user}
+RUN usermod -aG sudo ${user}
+RUN echo "${user}:888888" | chpasswd
+
+    # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
+RUN sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
+    && apt-get update && apt-get install -y --no-install-recommends sudo \
+    libc-bin \
+    binutils
+
+# ********************************************************
+# * Anything else you want to do like clean up goes here *
+# ********************************************************
+RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/jasper/.bashrc \
+    && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
+
+# [Optional] Set the default user. Omit if you want to keep the default as root.
+USER $user
+CMD ["/bin/bash"]