forked from maartenplieger/climexp_numerical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.conda
53 lines (41 loc) · 1.97 KB
/
Dockerfile.conda
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
# vim:set ft=dockerfile:
FROM continuumio/miniconda3
MAINTAINER https://github.com/cp4cds/copernicus
LABEL Description="Climate explorer Demo" Vendor="KNMI" Version="0.1.0"
# Update Debian system
RUN apt-get update && apt-get install -y \
build-essential \
fonts-dejavu \
&& rm -rf /var/lib/apt/lists/*
# Update conda
RUN conda update -n base conda
COPY environment.yml /opt/environment.yml
# Create conda environment
RUN conda env create -n wps -f /opt/environment.yml
WORKDIR /src
ENV MY_CONDA_ENV /opt/conda/envs/wps
ENV gsl_CFLAGS "-I${MY_CONDA_ENV}/include"
ENV gsl_LIBS "-L${MY_CONDA_ENV}/lib"
# Climate explorer expects libblas, not libopenblas
RUN ln -s /opt/conda/envs/wps/lib/libopenblas.so /opt/conda/envs/wps/lib/libblas.so
# Compile fortran gsl
WORKDIR /src
RUN curl -L "https://doku.lrz.de/download/attachments/28051060/fgsl-1.2.0.tar.gz" > fgsl.tar.gz && tar -xzvf fgsl.tar.gz
RUN ["/bin/bash", "-c", "source activate wps && cd /src/fgsl-1.2.0 && ./configure --prefix ${MY_CONDA_ENV}/ && make && make install" ]
# Compile fortran lapack, ensures that same fortran compiler is used as used to compile climate explorer
WORKDIR /src
RUN curl -L "http://www.netlib.org/lapack/lapack-3.8.0.tar.gz" > lapack-3.8.0.tar.gz && tar -xzvf lapack-3.8.0.tar.gz
RUN ["/bin/bash", "-c", "source activate wps && cd /src/lapack-3.8.0 && cp make.inc.example make.inc && make lapacklib && cp liblapack.a ${MY_CONDA_ENV}/lib " ]
# Install climate explorer from source, no conda package available
WORKDIR /src
ENV CPPFLAGS "-I${MY_CONDA_ENV}/include -I${MY_CONDA_ENV}/include/fgsl ${CPPFLAGS}"
ENV LDFLAGS "-L${MY_CONDA_ENV}/lib ${LDFLAGS}"
ENV FORTRAN_FLAGS ${CPPFLAGS} ${LDFLAGS}
ENV PVM_ARCH build
ENV LD_LIBRARY_PATH ${MY_CONDA_ENV}:${LD_LIBRARY_PATH}
COPY . climexp
WORKDIR /src/climexp/${PVM_ARCH}
COPY ./Docker/Makefile.docker /src/climexp/${PVM_ARCH}/Makefile
RUN ["/bin/bash", "-c", "source activate wps && make" ]
CMD bash
#docker build -f Dockerfile.conda -t climexp_numerical_conda .