-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.galactic
More file actions
38 lines (32 loc) · 1.49 KB
/
Dockerfile.galactic
File metadata and controls
38 lines (32 loc) · 1.49 KB
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
FROM osrf/ros:galactic-desktop
# Install system dependencies
# RUN apt-get update && apt-get install -y \
# git \
# && rm -rf /var/lib/apt/lists/*
# Add non-root user
ENV USERNAME=roboco
ENV USER_UID=1000
ENV USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Create and enter a ros workspace
WORKDIR /home/${USERNAME}/ros_ws/src
# Download source dependencies
# RUN git clone --branch main https://github.com/some-organisation/some-repo.git
# Install dependencies using rosdep
WORKDIR /home/${USERNAME}/ros_ws
# RUN apt-get update \
# && rosdep update \
# && DEBIAN_FRONTEND=noninteractive rosdep install --from-paths src --ignore-src -r --default-yes \
# && rm -rf /var/lib/apt/lists/*
# Change to the non-root user and update file ownership
RUN chown -R ${USERNAME} /home/${USERNAME}
USER $USERNAME
# Change prompt to show we are in a docker container
RUN echo "export PS1='\[\e]0;\u@docker: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@docker\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> /home/${USERNAME}/.bashrc
# Automatically source ros setup files
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/${USERNAME}/.bashrc
# Build source packages
# RUN /bin/bash -c '. /opt/ros/$ROS_DISTRO/setup.bash; cd /home/${USERNAME}/ros_ws; catkin_make -DCMAKE_BUILD_TYPE=Release'