forked from lbl-srg/docker-ubuntu-jmodelica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
94 lines (85 loc) · 2.98 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
FROM ubuntu:16.04
MAINTAINER Michael Wetter <[email protected]>
# Set environment variables
ENV SRC_DIR /usr/local/src
ENV MODELICAPATH /usr/local/JModelica/ThirdParty/MSL
# Avoid warnings
# debconf: unable to initialize frontend: Dialog
# debconf: (TERM is not set, so the dialog frontend is not usable.)
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Install required packages
RUN apt-get update && \
apt-get install -y \
ant \
autoconf \
cmake \
cython \
default-jdk \
g++ \
gfortran \
ipython \
jcc \
libboost-dev \
openjdk-8-jdk \
pkg-config \
python-dev \
python-jpype \
python-lxml \
python-matplotlib \
python-nose \
python-numpy \
python-pip \
python-scipy \
subversion \
swig \
wget \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*
# Install jcc-3.0 to avoid error in python -c "import jcc"
RUN pip install --upgrade pip
RUN ln -s /usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-8-oracle && \
pip install --upgrade jcc
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN export JCC_JDK=/usr/lib/jvm/java-8-openjdk-amd64
# Get Install Ipopt and JModelica, and delete source code with is more than 1GB large
RUN cd $SRC_DIR && \
wget wget -O - http://www.coin-or.org/download/source/Ipopt/Ipopt-3.12.4.tgz | tar xzf - && \
cd $SRC_DIR/Ipopt-3.12.4/ThirdParty/Blas && \
./get.Blas && \
cd $SRC_DIR/Ipopt-3.12.4/ThirdParty/Lapack && \
./get.Lapack && \
cd $SRC_DIR/Ipopt-3.12.4/ThirdParty/Mumps && \
./get.Mumps && \
cd $SRC_DIR/Ipopt-3.12.4/ThirdParty/Metis && \
./get.Metis && \
cd $SRC_DIR/Ipopt-3.12.4 && \
./configure --prefix=/usr/local/Ipopt-3.12.4 && \
make install && \
cd $SRC_DIR && \
svn export https://svn.jmodelica.org/trunk JModelica && \
cd $SRC_DIR/JModelica/external && \
rm -rf $SRC_DIR/JModelica/external/Assimulo && \
svn export https://svn.jmodelica.org/assimulo/trunk Assimulo && \
cd $SRC_DIR/JModelica && \
rm -rf build && \
mkdir build && \
cd $SRC_DIR/JModelica/build && \
../configure --with-ipopt=/usr/local/Ipopt-3.12.4 --prefix=/usr/local/JModelica && \
make install && \
make casadi_interface && \
rm -rf $SRC_DIR
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
mkdir -p /etc/sudoers.d && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer
USER developer
ENV HOME /home/developer
# Avoid warning that Matplotlib is building the font cache using fc-list. This may take a moment.
# This needs to be towards the end of the script as the command writes data to
# /home/developer/.cache
RUN python -c "import matplotlib.pyplot"