-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (62 loc) · 2.26 KB
/
Dockerfile
File metadata and controls
78 lines (62 loc) · 2.26 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
######################################################################
# - Base stage
# - This stage serves as the base image for the following stages.
######################################################################
ARG ROS_DISTRO=humble
FROM osrf/ros:${ROS_DISTRO}-desktop AS base
LABEL org.opencontainers.image.title="ESP Daemon"
LABEL org.opencontainers.image.authors="scx@gapp.nthu.edu.tw"
LABEL org.opencontainers.image.licenses="MIT"
ARG USERNAME=ros
# Use the same UID and GID as the host user
ARG USER_UID=1000
ARG USER_GID=1000
######################################################################
# - User setup stage
# - Create a non-root user with default bash shell.
######################################################################
FROM base AS user-setup
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& 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/*
######################################################################
# - Tools Installation stage
# - Install common tools for development.
######################################################################
FROM user-setup AS tools
RUN apt-get update && apt-get install -y \
tree \
vim \
wget \
unzip \
python3-pip \
bash-completion \
ros-humble-rmw-cyclonedds-cpp \
ros-humble-foxglove-bridge
RUN apt-get update && apt-get dist-upgrade -y \
&& apt-get autoremove -y \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
######################################################################
# - Final stage
# - Install the main packages and set the entrypoint.
######################################################################
FROM tools AS final
# Set up the user environment
ENV TZ=Asia/Taipei
ENV SHELL=/bin/bash
ENV TERM=xterm-256color
USER $USERNAME
WORKDIR /esp_daemon
# Set up bashrc
COPY .bashrc /home/$USERNAME/.bashrc.conf
RUN cat /home/$USERNAME/.bashrc.conf >> /home/$USERNAME/.bashrc
# Set up python environment
# RUN pip install --upgrade pip
# RUN pip install --no-cache-dir
CMD ["/bin/bash"]