Dockerfile 4.32 KB
Newer Older
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
1
# docker build -t immc/dg-mingw:v0.2.11 .
2
3
4
5
6
7
8
9
10
11
12
FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y mingw-w64 mingw-w64-tools
RUN apt-get install -y cmake swig
RUN apt-get install -y p7zip-full zip wget

RUN mkdir -p /mingw64/lib
RUN mkdir -p /mingw64/include
RUN mkdir -p /mingw64/src

13
# netcdf
14
WORKDIR /mingw64/src
15
16
17
18
19
20
21
RUN apt-get install -y m4 && \
 wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.4.1.tar.gz && \
 tar xf netcdf-4.4.1.tar.gz && \
 cd netcdf-4.4.1 && \
 ./configure --prefix=/mingw64 --host=x86_64-w64-mingw32 --disable-netcdf-4 --disable-dap && \
 make -j8 && \
 make install
22

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
23
24
25
26
27
28
29
30
RUN apt-get install -y m4 && \
 wget http://dl.maptools.org/dl/libtiff/tiff-3.8.2.tar.gz && \
 tar xf tiff-3.8.2.tar.gz && \
 cd tiff-3.8.2 && \
 ./configure --prefix=/mingw64 --host=x86_64-w64-mingw32 && \
 make -j8 && \
 make install

31
# python-numpy-scipy-openblas
32
WORKDIR /mingw64/src
33
34
35
RUN wget http://launchpadlibrarian.net/279142124/p7zip-full_16.02+dfsg-1_amd64.deb && \
wget http://launchpadlibrarian.net/279142125/p7zip_16.02+dfsg-1_amd64.deb && \
dpkg -i p7zip_16.02+dfsg-1_amd64.deb p7zip-full_16.02+dfsg-1_amd64.deb 
36
37
38
39
40
41
42
43
44
45
RUN wget ftp://braque.mema.ucl.ac.be/slim-windows-build/Python34.zip && \
  unzip Python34.zip && \
  gendef Python34/python34.dll && \
  x86_64-w64-mingw32-dlltool -dpython34.def -l /mingw64/lib/libpython3.4.a -D python34.dll && \
  mv Python34/Lib/site-packages/numpy/core/libopenblaspy.dll Python34 && \
  gendef Python34/libopenblaspy.dll && \ 
  x86_64-w64-mingw32-dlltool -dlibopenblaspy.def -l /mingw64/lib/libblas.a -D libopenblaspy.dll && \
  sed -i '1i#define _hypot hypot\r' Python34/include/pyconfig.h && \
  mv Python34 ../

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# msmpi
RUN mkdir -p /mingw64/src/msmpi && \
  cd /mingw64/src/msmpi && \
  wget https://download.microsoft.com/download/A/1/3/A1397A8C-4751-433C-8330-F738C3BE2187/mpi_x64.Msi  && \
  7z x mpi_x64.Msi && \
  cp msmpi.lib msmpi64.lib /mingw64/lib && \
  cp mpiexec.exe smpd.exe /mingw64/Python34/ && \
  cp msmpi64.dll /mingw64/Python34/msmpi.dll && \
  sed '1i#include <stdint.h>\r'  mpi.h > /mingw64/include/mpi.h

# petsc
RUN apt-get install -y python
RUN \
  wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.7.3.tar.gz
RUN tar xf petsc-lite-3.7.3.tar.gz && cd petsc-3.7.3 && \
  sed -i 's/_WIN32/DISABLED/' include/petscsys.h &&\
  python2 ./configure --known-mpi-int64_t=1 --known-mpi-c-double-complex=1 --known-level1-dcache-size=32768 --known-level1-dcache-linesize=32 --known-level1-dcache-assoc=2 --known-endian=little --known-sizeof-char=1 --known-sizeof-void-p=8 --known-sizeof-short=2 --known-sizeof-int=4 --known-sizeof-long=4 --known-sizeof-long-long=8 --known-sizeof-float=4 --known-sizeof-double=8 --known-sizeof-size_t=8 --known-bits-per-byte=8 --known-memcmp-ok=1 --known-sizeof-MPI_Comm=4 --known-sizeof-MPI_Fint=4 --known-mpi-long-double=1 --known-sdot-returns-double=0 --known-snrm2-returns-double=0 --known-has-attribute-aligned=1 --with-cpp=x86_64-w64-mingw32-cpp --with-cc=x86_64-w64-mingw32-gcc --with-cxx=x86_64-w64-mingw32-c++ --with-ar=x86_64-w64-mingw32-ar --with-fortran=no --with-mpi-include=/mingw64/include --with-mpi-lib=/mingw64/lib/msmpi64.lib --with-x=no --with-blas-lapack-lib=/mingw64/lib/libblas.a --with-batch=1 --prefix=/mingw64/ --with-valgrind=no --with-debugging=no --CFLAGS=-DPETSC_HAVE_DIRECT_H COPTFLAGS=-O3 CXXOPTFLAGS=-03 && \
  make && \
  make install && \
  cp /mingw64/lib/libpetsc.so.3.7.3 /mingw64/Python34

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
67
68
69
# missing file
RUN cp /mingw64/bin/libtiff-3.dll /mingw64/Python34/

70
# cmake toolchain file
71
72
73
74
75
76
77
78
79
80
81
RUN echo "\ 
SET(CMAKE_SYSTEM_NAME Windows)\n\
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)\n\
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)\n\
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)\n\
SET(CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran)\n\
SET(CMAKE_FIND_ROOT_PATH /mingw64)\n\
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
SET(NUMPY_INC /mingw64/Python34/Lib/site-packages/numpy/core/include/)\n\
82
83
SET(MPI_C_LIBRARIES /mingw64/lib/msmpi64.lib)\n\
SET(MPI_C_INCLUDE_DIR /mingw64/include)\n\
84
85
86
87
SET(PYTHON_EXECUTABLE /mingw64/Python34/python.exe)\n\
SET(PYTHON_INCLUDE_DIR /mingw64/Python34/include/)\n\
SET(PYTHON_LIBRARY /mingw64/lib/libpython3.4.a)\n" > /mingw64/cmake-mingw

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
88
RUN apt-get install -y git
89
90
RUN useradd -ms /bin/bash builder
USER builder
91
WORKDIR /home/builder