-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile.base
160 lines (124 loc) · 5.48 KB
/
Dockerfile.base
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
ARG BASE_TAG=22.04
FROM ubuntu:${BASE_TAG} as core-build-dependencies
ENV DEBIAN_FRONTEND=noninteractive
# install core compilation and access dependencies for building the libraries
RUN apt-get update && apt-get install -y \
autoconf \
automake \
build-essential \
cmake \
curl \
g++ \
gcc \
git \
gnupg2 \
libtool \
lsb-release \
make \
pkg-config \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
FROM core-build-dependencies as google-dependencies
RUN apt-get update && apt-get install -y \
libgtest-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install gtest
WORKDIR /tmp
RUN mkdir gtest_build && cd gtest_build && cmake /usr/src/gtest && make -j \
&& cp lib/* /usr/local/lib || cp *.a /usr/local/lib
RUN rm -rf /tmp/* && ldconfig
FROM core-build-dependencies as robot-model-dependencies
RUN apt-get update && apt-get install -y \
libboost-all-dev \
liburdfdom-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
ARG EIGEN_TAG=3.4.0
RUN wget -c https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_TAG}/eigen-${EIGEN_TAG}.tar.gz -O - | tar -xz \
&& cd eigen-${EIGEN_TAG} && mkdir build && cd build && env CXXFLAGS=-DEIGEN_MPL2_ONLY cmake .. && make install \
&& cd ../.. && rm -r eigen-${EIGEN_TAG} || exit 1
ARG OSQP_TAG=0.6.2
RUN git clone --depth 1 -b v${OSQP_TAG} --recursive https://github.com/oxfordcontrol/osqp \
&& cd osqp && mkdir build && cd build && cmake -G "Unix Makefiles" .. && cmake --build . --target install \
&& cd ../.. && rm -r osqp || exit 1
ARG OSQP_EIGEN_TAG=0.6.4
RUN git clone --depth 1 -b v${OSQP_EIGEN_TAG} https://github.com/robotology/osqp-eigen.git \
&& cd osqp-eigen && mkdir build && cd build && cmake .. && make -j && make install \
&& cd ../.. && rm -r osqp-eigen || exit 1
ARG PINOCCHIO_TAG=2.6.9
RUN git clone --depth 1 -b v${PINOCCHIO_TAG} --recursive https://github.com/stack-of-tasks/pinocchio \
&& cd pinocchio && mkdir build && cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PYTHON_INTERFACE=OFF \
-DBUILD_TESTING=OFF && make -j $(nproc --ignore=1) && make install && cd ../.. && rm -r pinocchio || exit 1
RUN ldconfig
FROM robot-model-dependencies as development-dependencies
RUN apt-get update && apt-get install -y \
clang \
gdb \
python3 \
python3-dev \
python3-pip \
tar \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install python requirements
RUN pip3 install numpy setuptools pybind11
# install google dependencies
COPY --from=google-dependencies /usr/include/gtest /usr/include/gtest
COPY --from=google-dependencies /usr/local/lib/libgtest* /usr/local/lib/
FROM development-dependencies as proto-dependencies-20.04
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:20.04 /usr/local/include/google /usr/local/include/google
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:20.04 /usr/local/lib/libproto* /usr/local/lib/
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:20.04 /usr/local/bin/protoc /usr/local/bin
RUN ldconfig
FROM development-dependencies as proto-dependencies-22.04
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:22.04 /usr/local/include/google /usr/local/include/google
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:22.04 /usr/local/lib/libproto* /usr/local/lib/
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:22.04 /usr/local/bin/protoc /usr/local/bin
RUN ldconfig
FROM development-dependencies as proto-dependencies-latest
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:latest /usr/local/include/google /usr/local/include/google
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:latest /usr/local/lib/libproto* /usr/local/lib/
COPY --from=ghcr.io/epfl-lasa/control-libraries/proto-dependencies:latest /usr/local/bin/protoc /usr/local/bin
RUN ldconfig
FROM proto-dependencies-${BASE_TAG} as license-information
RUN mkdir -p /usr/share/doc/control-libraries
COPY ./licenses /usr/share/doc/control-libraries/licenses
FROM license-information as ssh-configuration
RUN apt-get update && apt-get install -y \
sudo \
libssl-dev \
ssh \
iputils-ping \
rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Configure sshd server settings
RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PubkeyAuthentication yes'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_config_development \
&& mkdir /run/sshd
ENV USER developer
ENV HOME /home/${USER}
# create and configure a new user
ARG UID=1000
ARG GID=1000
RUN addgroup --gid ${GID} ${USER}
RUN adduser --gecos "Remote User" --uid ${UID} --gid ${GID} ${USER} && yes | passwd ${USER}
RUN usermod -a -G dialout ${USER}
RUN echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99_aptget
RUN chmod 0440 /etc/sudoers.d/99_aptget && chown root:root /etc/sudoers.d/99_aptget
# Configure sshd entrypoint to authorise the new user for ssh access and
# optionally update UID and GID when invoking the container with the entrypoint script
COPY ./docker/sshd_entrypoint.sh /sshd_entrypoint.sh
RUN chmod 744 /sshd_entrypoint.sh
# create the credentials to be able to pull private repos using ssh
RUN mkdir /root/.ssh/ && ssh-keyscan github.com | tee -a /root/.ssh/known_hosts
RUN echo "session required pam_limits.so" | tee --append /etc/pam.d/common-session > /dev/null
WORKDIR ${HOME}