-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile-base
More file actions
72 lines (65 loc) · 2.99 KB
/
Dockerfile-base
File metadata and controls
72 lines (65 loc) · 2.99 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
# This Dockerfile is for building GridLAB-D with MySQL for PyVVO.
# Don't build this directly, use build.sh.
FROM debian:stretch
# Setup environment variables for building.
ENV PYVVO=/pyvvo \
TEMP_DIR=/tmp/pyvvo
WORKDIR ${TEMP_DIR}
# Arguments for mysql-apt-config and GridLAB-D (GLD) locations.
ARG mysql_apt
ENV mysql_apt=${mysql_apt}
ARG mysql_apt_deps
ENV mysql_apt_deps=${mysql_apt_deps}
ARG GLD
# Add GridLAB-D and MSCC archives. Hard-code build directory.
ADD $GLD $mysql_apt install_libmysqlclient-dev.sh ${TEMP_DIR}/
ENV CXXFLAGS=-I${PYVVO}/share/gridlabd \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PYVVO}/lib:/usr/lib/x86_64-linux-gnu \
PATH=${PATH}:/${PYVVO}/bin \
BUILD_PACKAGES="autoconf automake g++ libtool make gcc git"
# TODO: In an ideal world, there would be a seperate docker container
# which contains GridLAB-D, rather than installing GridLAB-D into the
# PyVVO container. However, the level of effort to get that going simply
# isn't worth it right now.
# Install necessary packages.
RUN mkdir ${PYVVO} \
&& perl -E "print '*' x 80" \
&& printf '\nInstalling packages for software builds/installation...\n' \
&& apt-get update && apt-get -y --no-install-recommends install ${BUILD_PACKAGES} \
&& ./install_libmysqlclient-dev.sh ${mysql_apt} "${mysql_apt_deps}" \
# Clean out our apt list.
&& rm -rf /var/lib/opt/lists/* \
# Install Xerces
&& perl -E "print '*' x 80" \
&& printf '\nInstalling Xerces...\n' \
&& cd ${TEMP_DIR}/gridlab-d/third_party \
&& tar -xzf xerces-c-3.2.0.tar.gz \
&& cd ${TEMP_DIR}/gridlab-d/third_party/xerces-c-3.2.0 \
&& ./configure --prefix=${PYVVO} --disable-static CFLAGS=-O2 CXXFLAGS=-O2 \
&& make -j $(($(nproc) + 1)) \
&& make -j $(($(nproc) + 1)) install \
# Install GridLAB-D
# TODO - should we run the GridLAB-D tests?
&& perl -E "print '*' x 80" \
&& printf '\nInstalling GridLAB-D...\n' \
&& cd ${TEMP_DIR}/gridlab-d \
&& autoreconf -isf \
# http://gridlab-d.shoutwiki.com/wiki/Builds
&& ./configure --prefix=${PYVVO} --with-mysql=/usr --with-xerces=${PYVVO} --enable-silent-rules 'CFLAGS=-g -O2 -w' 'CCFLAGS=-g -O2 -w' 'CXXFLAGS=-g -O2 -w' 'LDFLAGS=-g -O2 -w' \
# Do some nasty hard-coded replacement in the Makefile so that it
# can properly find mysql.h and libmysqlclient.so.
&& sed "s@MYSQL_LDFLAGS = '-L/usr/lib'@MYSQL_LDFLAGS = '-L/usr/lib/x86_64-linux-gnu'@" Makefile > tmp.txt \
&& rm Makefile \
&& sed "s@MYSQL_CPPFLAGS = '-I/usr/include'@MYSQL_CPPFLAGS = '-I/usr/include/mysql'@" tmp.txt > Makefile \
&& make -j $(($(nproc) + 1)) \
&& make -j $(($(nproc) + 1)) install \
# Clean up source installs
&& perl -E "print '*' x 80" \
&& printf '\nCleaning up temporary directory...\n' \
&& cd "${PYVVO}" \
&& /bin/rm -rf "${TEMP_DIR}" \
# Remove software used for building.
&& perl -E "print '*' x 80" \
&& printf '\nRemoving packages...\n' \
&& apt-get purge -y --auto-remove ${BUILD_PACKAGES} \
&& apt-get -y clean