-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
80 lines (55 loc) · 2.17 KB
/
Dockerfile
File metadata and controls
80 lines (55 loc) · 2.17 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FROM ubuntu:22.04 AS builder
# Install build essentials
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
python3-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/casadi/casadi.git -b main casadi
RUN cd casadi && mkdir build && cd build && cmake .. && make && make install DESTDIR=/casadi-install
RUN git clone https://github.com/jbeder/yaml-cpp.git
RUN cd yaml-cpp && mkdir -p build && cd build && cmake .. && cmake --build . && make && make install DESTDIR=/yaml-cpp-install
FROM osrf/ros:humble-desktop-full-jammy
COPY --from=builder /casadi-install/ /
COPY --from=builder /yaml-cpp-install/ /
# Create a non-root user
ARG USERNAME=ros
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ENV DISPLAY=:0
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& mkdir /home/$USERNAME/.config && chown $USER_UID:$USER_GID /home/$USERNAME/.config
# Set up sudo
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/*
# Copy the entrypoint and bashrc scripts so we have
# our container's environment set up correctly
# Set ENV for NVIDIA
ENV NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
WORKDIR /home/$USERNAME/
RUN apt-get update && apt-get install -y \
ros-humble-gazebo-ros2-control \
ros-humble-joint-state-publisher-gui \
ros-humble-ros2-control \
ros-humble-joint-state-broadcaster \
python3-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN pip install numpy==1.25 && pip install numpy-quaternion
COPY docker_res/entrypoint.sh /entrypoint.sh
COPY docker_res/bashrc /home/${USERNAME}/.bashrc
USER ros
RUN bash -c "source /home/ros/.bashrc"
# RUN sudo echo 'source /home/ros/install/setup.bash' >> /home/${USERNAME}/.bashrc
RUN sudo chmod +x /entrypoint.sh
# Set up entrypoint and default command
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]