forked from GRIDAPPSD/pyvvo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
59 lines (48 loc) · 1.86 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
# NOTE: Do not directly call docker build. Instead run build.sh.
#
# Build on top of the base application container for GridAPPS-D, which
# is a Debian-based Python container and contains some GridAPPS-D
# utilities.
# Work around docker bug:
# https://stackoverflow.com/questions/51981904/cant-build-docker-multi-stage-image-using-arg-in-copy-instruction
ARG TAG
FROM gridappsd/pyvvo:base-${TAG:-latest} as base
FROM gridappsd/app-container-base:develop
# Work from pyvvo.
ENV PYVVO=/pyvvo
WORKDIR ${PYVVO}
# Setup other environment variables:
# MSCC --> MySQL Connector/C
# All libs are going into /pyvvo/lib except MSCC
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PYVVO}/lib:/usr/local/mysql/lib \
PATH=${PATH}:/${PYVVO}/bin \
GLPATH=${PYVVO}/lib/gridlabd:${PYVVO}/share/gridlabd
# Copy in stuff from our base container.
ARG TAG
COPY --from=base ${PYVVO} ${PYVVO}
# Arguments for mysql-apt-config.
ARG mysql_apt
ENV mysql_apt=${mysql_apt}
ARG mysql_apt_deps
ENV mysql_apt_deps=${mysql_apt_deps}
# Copy files in.
COPY requirements.txt setup.py install_libmysqlclient-dev.sh ${mysql_apt} ${PYVVO}/
# Install libmysqlclient-dev and Python requirements.
RUN BUILD_DEPS="build-essential libssl-dev python3-dev" \
&& apt-get update \
&& ./install_libmysqlclient-dev.sh ${mysql_apt} "${mysql_apt_deps}" \
&& rm ${mysql_apt} \
&& rm install_libmysqlclient-dev.sh \
&& apt-get -y --no-install-recommends install ${BUILD_DEPS} \
&& pip install --no-cache-dir -r requirements.txt \
# Apt cleaning.
&& rm -rf /var/lib/opt/lists/* \
&& apt-get purge -y --auto-remove ${BUILD_DEPS} \
&& apt-get -y clean
# Add the PyVVO application files.
ARG PYVVO_ARCHIVE
ADD ${PYVVO_ARCHIVE} ${PYVVO}/pyvvo
# Create a symlink to the application configuration.
RUN ln -s /pyvvo/pyvvo/pyvvo/platform_config.json /appconfig
# Work from code directory.
WORKDIR ${PYVVO}/pyvvo