-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
176 lines (150 loc) · 5.74 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
ARG BASE_IMAGE=ubuntu:18.04
#Download base image ubuntu 20.04
FROM $BASE_IMAGE
# Dockerfile info
LABEL maintainer="[email protected]"
LABEL version="0.1"
LABEL description="Docker image to run CI for iiwa-fri-gym."
RUN apt-get update
RUN apt-get install -y locales
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV TZ=Europe/Madrid
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
ARG USER=docker
# Run the next steps with bash
SHELL ["/bin/bash", "-c"]
# Install sudo
RUN apt-get install -y sudo
# Create new user `${USER}` and disable
# password and gecos for later
# --gecos explained well here:
# https://askubuntu.com/a/1195288/635348
RUN adduser --disabled-password \
--gecos '' ${USER} || true
# Add new user ${USER} to sudo group
RUN adduser ${USER} sudo || true
# Ensure sudo group users are not
# asked for a password when using
# sudo command by ammending sudoers file
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> \
/etc/sudoers
# now we can set USER to the
# user we just created
USER ${USER}
# Run the next steps with bash
SHELL ["/bin/bash", "-c"]
WORKDIR /home/${USER}/
# Install dependencies from package manager.
RUN sudo apt-get install --yes \
build-essential \
autotools-dev \
autoconf \
pkg-config \
automake \
libopenblas-dev \
liblapack-dev \
freeglut3-dev \
libxi-dev \
libxmu-dev \
doxygen \
python3 \
python3-dev \
python3-numpy \
python3-setuptools \
openjdk-8-jdk \
libpcre3 \
libpcre3-dev \
byacc \
git \
gfortran \
libtool \
software-properties-common \
wget
# Missind Dependencies
RUN sudo apt-get install -y --fix-missing \
libadolc-dev \
coinor-libipopt-dev
# Install cmake 3.15+
RUN mkdir -p ~/opensim-workspace/cmake && cd ~/opensim-workspace/cmake && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc > cmake.key && \
sudo apt-key add cmake.key && \
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && \
sudo apt-get update && \
sudo apt install --yes cmake cmake-curses-gui
# Set the number of cores to use for building.
ARG BUILD_CORES=4
# Download and install SWIG.
RUN mkdir -p ~/opensim-workspace/swig-source && cd ~/opensim-workspace/swig-source && \
wget https://github.com/swig/swig/archive/refs/tags/rel-4.0.2.tar.gz && \
tar xzf rel-4.0.2.tar.gz && cd swig-rel-4.0.2 && \
sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache && \
make && make -j$BUILD_CORES install
# Download and install NetBeans 12.3.
RUN mkdir -p ~/opensim-workspace/Netbeans12.3 && cd ~/opensim-workspace/Netbeans12.3 && \
wget -q https://archive.apache.org/dist/netbeans/netbeans/12.3/Apache-NetBeans-12.3-bin-linux-x64.sh && \
chmod 755 Apache-NetBeans-12.3-bin-linux-x64.sh && \
./Apache-NetBeans-12.3-bin-linux-x64.sh --silent
# Get opensim-core.
RUN git clone https://github.com/opensim-org/opensim-core.git ~/opensim-workspace/opensim-core-source && \
cd ~/opensim-workspace/opensim-core-source && \
git checkout branch_4.4
# Build opensim-core dependencies.
RUN mkdir -p ~/opensim-workspace/opensim-core-source/dependencies/build && \
cd ~/opensim-workspace/opensim-core-source/dependencies/build && \
cmake ~/opensim-workspace/opensim-core-source/dependencies \
-DCMAKE_INSTALL_PREFIX='~/opensim-workspace/opensim-core-dependencies/' \
-DCMAKE_BUILD_TYPE='RelWithDebInfo' \
-DSUPERBUILD_simbody=ON \
-DSUPERBUILD_spdlog=ON \
-DSUPERBUILD_ezc3d=ON \
-DSUPERBUILD_docopt=ON \
-DSUPERBUILD_BTK=OFF \
-DOPENSIM_WITH_CASADI=ON \
-DOPENSIM_WITH_TROPTER=ON && \
make -j$BUILD_CORES
# Build opensim-core.
RUN mkdir -p ~/opensim-workspace/opensim-core-source/build && \
cd ~/opensim-workspace/opensim-core-source/build && \
cmake ../ \
-DBUILD_JAVA_WRAPPING=ON \
-DBUILD_PYTHON_WRAPPING=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE='RelWithDebInfo' \
-DCMAKE_INSTALL_PREFIX='~/opensim-core' \
-DOPENSIM_C3D_PARSER=ezc3d \
-DOPENSIM_COPY_DEPENDENCIES=ON \
-DOPENSIM_COPY_DEPENDENCIES=ON \
-DOPENSIM_DEPENDENCIES_DIR='~/opensim-workspace/opensim-core-dependencies/' \
-DOPENSIM_INSTALL_UNIX_FHS=OFF \
-DOPENSIM_WITH_CASADI=ON \
-DOPENSIM_WITH_TROPTER=ON \
-DSWIG_DIR=~/swig/share/swig \
-DSWIG_EXECUTABLE=~/swig/bin/swig/ \
-DWITH_BTK=OFF \
-DWITH_EZC3D=ON &&\
make -j$BUILD_CORES && \
make install
# Get opensim-gui.
RUN git clone https://github.com/opensim-org/opensim-gui.git ~/opensim-workspace/opensim-gui-source && \
cd ~/opensim-workspace/opensim-gui-source && \
git submodule update --init --recursive -- opensim-models opensim-visualizer Gui/opensim/threejs
# Build opensim-gui.
RUN mkdir -p ~/opensim-workspace/opensim-gui-source/build && \
cd ~/opensim-workspace/opensim-gui-source/build && \
cmake ../ \
-DCMAKE_PREFIX_PATH="~/opensim-core" \
-DAnt_EXECUTABLE="~/netbeans-12.3/netbeans/extide/ant/bin/ant" \
-DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=$HOME/netbeans-12.3/netbeans;-Dnbplatform.default.harness.dir=$HOME/netbeans-12.3/netbeans/harness" && \
make CopyOpenSimCore && \
make PrepareInstaller
RUN echo "export USER='$(whoami)'" >> ~/.bashrc
# Install dependencies that support WebGL https://stackoverflow.com/questions/69351416/docker-webgl-headless-chrome-error-passthrough-is-not-supported-gl-is-disa
RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -y xorg xserver-xorg xvfb libx11-dev libxext-dev
# Install opensim-gui.
RUN cd ~/opensim-workspace/opensim-gui-source/Gui/opensim/dist/installer/opensim && \
bash INSTALL
CMD ["/opt/opensim-gui/bin/opensim"]