/
Dockerfile.pipelines
134 lines (107 loc) · 4.07 KB
/
Dockerfile.pipelines
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
FROM ubuntu:bionic
# This DockerFile is looked after by
MAINTAINER Tim Greaves <tim.greaves@imperial.ac.uk>
# Ensure UTF-8 environment is correct for documentation builds
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Use bash, not dash, or later conditionals fail
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
# Upgrade to the most recent package set
RUN apt-get update
RUN apt-get -y dist-upgrade
# Needed for the conda and devito installs later
RUN apt-get -y install wget bzip2 git make
# Default gcc version to install
ARG gccVersion=8
ENV DEVITO_ARCH=gcc-$gccVersion
ENV CC=gcc-$gccVersion
ENV CXX=g++-$gccVersion
# Set Yask variables in case they are needed
ENV YC_CXX=g++-$gccVersion
# Default devito install method
ARG installWithPip=false
ENV testWithPip=$installWithPip
# Use a different back-end?
ARG DEVITO_BACKEND=none
ENV DEVITO_BACKEND=$DEVITO_BACKEND
# Use OpenMP?
ARG DEVITO_OPENMP=0
ENV DEVITO_OPENMP=$DEVITO_OPENMP
ENV OMP_NUM_THREADS=2
# Use MPI?
ARG MPI_INSTALL=1
ENV MPI_INSTALL=$MPI_INSTALL
# Run examples?
ARG RUN_EXAMPLES='false'
ENV RUN_EXAMPLES=$RUN_EXAMPLES
# Python version?
ARG PYTHON_VERSION='3.6'
ENV PYTHON_VERSION=$PYTHON_VERSION
# Ensure a non-interactive matplotlib backend
ENV MPLBACKEND=agg
# Install gcc/g++
RUN apt-get -y install gcc-$gccVersion g++-$gccVersion
# Set up alternatives
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$gccVersion 10
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-$gccVersion 10
RUN update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-$gccVersion 10
RUN update-alternatives --install /usr/bin/nm nm /usr/bin/gcc-nm-$gccVersion 10
RUN update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-$gccVersion 10
RUN update-alternatives --install /usr/bin/ranlib ranlib /usr/bin/gcc-ranlib-$gccVersion 10
RUN if [ -f /usr/bin/gcov-dump-$gccVersion ] ; then \
update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-$gccVersion 10 ; \
fi
RUN if [ -f /usr/bin/gcov-tool-$gccVersion ] ; then \
update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-$gccVersion 10 ; \
fi
# Install MPI
RUN if [ "$MPI_INSTALL" == "1" ] ; then \
apt-get install -y -q mpich libmpich-dev ; \
fi
# Make sure the correct gcc is linked as mpich reinstalls one
RUN rm -f /usr/bin/gcc && ln -s /usr/bin/gcc-$gccVersion /usr/bin/gcc ;
# Set up path to support (optional) Conda install
ENV PATH=/usr/local/miniconda/bin:$PATH
# Python installs
RUN if [ $installWithPip == "true" ] ; then \
if [ "$PYTHON_VERSION" == "3.8"] ; then \
apt update ; \
apt install -y software-properties-common ; \
fi ; \
apt-get install -y python$PYTHON_VERSION-dev python3-pip ; \
rm -f /usr/bin/python && ln -s /usr/bin/python$PYTHON_VERSION /usr/bin/python ; \
else \
wget --no-verbose https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh ; \
bash /tmp/miniconda.sh -b -p /usr/local/miniconda ; \
conda config --set always_yes yes --set changeps1 no ; \
fi
RUN adduser --disabled-password --gecos "" devito
COPY . /home/devito
RUN chown -R devito /home/devito
USER devito
WORKDIR /home/devito
RUN if [ $installWithPip == "true" ] ; then \
python setup.py install --user ; \
if [ $MPI_INSTALL == '1' ] ; then \
python -m pip install --user -e .[extras] ; \
fi ; \
else \
sed -i -E 's/(python=)(.*)/\1'$PYTHON_VERSION'/' environment.yml ; \
conda env create -q -f environment.yml; \
source activate devito ; \
conda update -q conda ; \
echo $PATH ; \
pip install -e . ; \
if [ $MPI_INSTALL == '1' ] ; then \
pip install -r requirements-optional.txt ; \
fi ; \
if [ $RUN_EXAMPLES == "true" ] ; then \
pip install matplotlib ; \
fi ; \
pip install pytest-xdist ; \
if [ $MPI_INSTALL == '1' ] ; then \
bash scripts/create_ipyparallel_mpi_profile.sh; \
fi ; \
fi
ENTRYPOINT /home/devito/azure-pipelines.py