This repository has been archived by the owner on Oct 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.jenkins
109 lines (92 loc) · 4.33 KB
/
Dockerfile.jenkins
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
FROM ubuntu:xenial
# This DockerFile is looked after by
MAINTAINER Tim Greaves <[email protected]>
# Add the ubuntu-toolchain-r test ppa
RUN echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main" > /etc/apt/sources.list.d/ubuntu-toolchain-r-ppa-xenial.list
# Import the Launchpad PPA public key
RUN gpg --keyserver keyserver.ubuntu.com --recv 1E9377A2BA9EF27F
RUN gpg --export --armor BA9EF27F | apt-key add -
# 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; can be overridden in Jenkinsfile
ARG gccvers=4.9
ENV DEVITO_ARCH=gcc-$gccvers
# Install gcc/g++
RUN apt-get -y install gcc-$gccvers g++-$gccvers
# Set up alternatives
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$gccvers 10
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-$gccvers 10
RUN update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-$gccvers 10
RUN update-alternatives --install /usr/bin/ar ar /usr/bin/gcc-ar-$gccvers 10
RUN update-alternatives --install /usr/bin/nm nm /usr/bin/gcc-nm-$gccvers 10
RUN update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-$gccvers 10
RUN update-alternatives --install /usr/bin/ranlib ranlib /usr/bin/gcc-ranlib-$gccvers 10
RUN if [ -f /usr/bin/gcov-dump-$gccvers ] ; then \
update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-$gccvers 10 ; \
fi
RUN if [ -f /usr/bin/gcov-tool-$gccvers ] ; then \
update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-$gccvers 10 ; \
fi
# Set up for Miniconda
WORKDIR /tmp
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
RUN bash miniconda.sh -b -p /usr/local/miniconda
ENV PATH /usr/local/miniconda/bin:$PATH
RUN conda config --set always_yes yes --set changeps1 no
RUN conda update -q conda
RUN ln -s /usr/local/miniconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
# Debugging step to finish
RUN conda info -a
# Add working version of devito to image
WORKDIR /usr/local/devito
# Obscure syntax: 'recursively add all the contents of docker's working directory to
# the working directory in the container
ADD . / ./
# Install devito into the image
RUN conda env create -q -f environment.yml python
# *** NOTE TO FUTURE DEVELOPERS REUSING THIS JENKINSFILE FOR DEPLOYMENT ***
# Normal activation of virtualenv doesn't persist; set environment explicitly so that
# when Jenkins runs the container it will start up with the devito virtualenv active.
# Note that this may not be ideal for non-Jenkins-intended containers, BUT does need
# to be present before the devito install as 'RUN source activate devito' doesn't
# persist into the next RUN and devito will end up being installed into base instead
# of into the devito virtualenv. On the other hand, defaulting to a devito virtualenv
# in a devito container seems like a pretty sensible thing to happen...
ENV CONDA_DEFAULT_ENV="devito"
ENV CONDA_EXE="/usr/local/miniconda/bin/conda"
ENV CONDA_PREFIX="/usr/local/miniconda/envs/devito"
ENV CONDA_PROMPT_MODIFIER="(devito) "
ENV CONDA_PYTHON_EXE="/usr/local/miniconda/bin/python"
ENV CONDA_SHLVL="1"
ENV PATH="/usr/local/miniconda/envs/devito/bin:$PATH"
# Now install devito into the virtualenv
RUN pip install -e .
# Add in parallel testing
RUN pip install pytest-xdist
# Debugging step to finish
RUN conda list
# Disable key checking for github.com
RUN echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> /etc/ssh/config
# Devito back-end set at build-time for Jenkins images
WORKDIR /usr/localwhich python ; python --version ; gcc --version
ARG DEVITO_BACKEND
RUN if [ "x$DEVITO_BACKEND" = "xyask" ] ; then \
conda install swig ; \
apt-get -y install make ; \
git clone https://github.com/opesci/yask.git ; \
make -C yask/ compiler compiler-api ; \
pip install -e yask/ ; \
fi
# Extra environment to get click using utf8
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Ensure Matplotlib doesn't look for interactive backends that need
# extra libraries (ie, libGL) to be present
ENV MPLBACKEND=PS
# Codecov token to push coverage reports
ENV CODECOV_TOKEN=67a18b2a-77f0-4722-9c88-bc1a098473ce
# By default, start the container in the devito directory
WORKDIR /usr/local/devito