-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile
109 lines (95 loc) · 2.71 KB
/
Dockerfile
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
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /
##############################
# Core tools
##############################
RUN apt-get update -y -qq \
&& apt-get install -y -qq --no-install-recommends \
apt-utils \
lsb-release \
build-essential \
software-properties-common \
ca-certificates \
gpg-agent \
wget \
git \
cmake \
lcov \
gcc \
clang \
clang-tidy \
clang-format \
libomp-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
##############################
# Non-root user Setup
##############################
ARG USERNAME=dev
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
sudo \
gosu \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --home-dir /home/$USERNAME --shell /bin/bash --user-group --groups adm,sudo $USERNAME \
&& echo $USERNAME:$USERNAME | chpasswd \
&& echo $USERNAME ALL=\(ALL\) NOPASSWD:ALL >> /etc/sudoers \
&& touch home/$USERNAME/.sudo_as_admin_successful \
&& gosu $USERNAME mkdir -p /home/$USERNAME/.xdg_runtime_dir
ENV XDG_RUNTIME_DIR=/home/$USERNAME/.xdg_runtime_dir
##############################
# Eigen
##############################
RUN apt-get update -y -qq \
&& apt-get install -y -qq --no-install-recommends \
libeigen3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
##############################
# NL Optimization
##############################
RUN git clone https://github.com/stevengj/nlopt /tmp/nlopt \
&& cd /tmp/nlopt \
&& mkdir build \
&& cd build \
&& cmake \
-D CMAKE_BUILD_TYPE=Release \
-D NLOPT_PYTHON=OFF \
-D NLOPT_OCTAVE=OFF \
-D NLOPT_MATLAB=OFF \
-D NLOPT_GUILE=OFF \
-D NLOPT_SWIG=OFF \
.. \
&& make -j$(($(nproc)-1)) \
&& make install \
&& rm -rf /tmp/*
##############################
# OSQP Solver
##############################
RUN git clone --depth 1 --branch v0.6.3 --recursive https://github.com/osqp/osqp /tmp/osqp \
&& cd /tmp/osqp \
&& mkdir build \
&& cd build \
&& cmake \
-G "Unix Makefiles" \
.. \
&& make -j$(($(nproc)-1)) \
&& make install \
&& rm -rf /tmp/*
##############################
# Catch2
##############################
RUN git clone https://github.com/catchorg/Catch2.git /tmp/Catch2 \
&& cd /tmp/Catch2 \
&& mkdir build \
&& cd build \
&& cmake \
-D BUILD_TESTING=OFF \
.. \
&& make -j$(($(nproc)-1)) \
&& make install \
&& rm -rf /tmp/*
# # (Optional) Set Clang as the default compiler
# ENV CC=/usr/bin/clang
# ENV CXX=/usr/bin/clang++