forked from guanxyz/MPAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfilempasio
137 lines (117 loc) · 4.26 KB
/
Dockerfilempasio
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
135
136
from randalburns/pvcat:mpich
MAINTAINER qguan "[email protected]"
# The proxy is for Darwin and other machines within LANL.
#ENV http_proxy 'http://proxyout.lanl.gov:8080'
#ENV https_proxy 'http://proxyout.lanl.gov:8080'
#ENV no_proxy 'localhost,127.0.0.1'
#RUN echo 'Acquire::http::Proxy "http://proxyout.lanl.gov:8080";' >> /etc/apt/apt.conf.d/docker-clean
RUN apt-get -y update
RUN apt-get -y install\
build-essential\
ctags\
curl\
vim\
bison\
flex\
subversion\
python-setuptools\
ruby\
wget
##################################################
# Install brew
##################################################
RUN git clone https://github.com/Linuxbrew/linuxbrew.git ~/.linuxbrew
RUN echo "export PATH="$HOME/.linuxbrew/bin:$PATH"" >> ~/.bashrc
RUN echo "export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"" >> ~/.bashrc
RUN echo "export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"">> ~/.bashrc
##################################################
# Add active user (user:user)
##################################################
RUN groupadd -r user && useradd -r -m -g user user
##################################################
# TO-DO :Configure the No-Password SSH in docker
##################################################
#COPY ~/.ssh/id_rsa.pub /home/user/.ssh/
#RUN cat /home/user/.ssh/id_rsa.pub >> /home/user/.ssh/authorized_keys
#RUN chown -R user:user /home/user/.ssh; chmod 0700 -R /home/user/.ssh
#RUN cat /root/.ssh/id_rsa.pub >> /home/user/.ssh/authorized_keys
# Asume that we are using the openmpi now!
# RUN sed -i 's/Port 22/Port 9222/' /etc/ssh/sshd_config
COPY id_rsa /home/user/.ssh/
COPY id_rsa.pub /home/user/.ssh/
COPY config /home/user/.ssh/
RUN chown -R user:user /home/user/.ssh; chmod 0700 /home/user/.ssh; chmod 0600 /home/user/.ssh/*
RUN sed -i 's/Port 22/Port 9222/' /etc/ssh/sshd_config
# add no password login
RUN cat /home/user/.ssh/id_rsa.pub >> /home/user/.ssh/authorized_keys
RUN chown -R user:user /home/user
##################################################
# Build the directories
##################################################
USER user
WORKDIR /home/user
RUN mkdir LANL LANL/libs LANL/MPAS LANL/temp
RUN mkdir LANL/libs/netcdf LANL/libs/pnetcdf LANL/libs/pio
RUN mkdir LANL/libs/pio/lib LANL/libs/pio/include
RUN chmod -R ug+rw /home/user/LANL
#################################################
# Setup environment
##################################################
# For the paths
##################
ENV MPAS_PATH /home/user/LANL
ENV MPAS_LIBS_PATH /home/user/LANL/libs
ENV IO_DEST $MPAS_LIBS_PATH/io
ENV NETCDF_C_SOURCE $MPAS_LIBS_PATH/netcdf-4.3.2
ENV NETCDF_F_SOURCE $MPAS_LIBS_PATH/netcdf-fortran-4.4.1
ENV PIO_SOURCE $MPAS_LIBS_PATH/pio1_7_1/pio
ENV NETCDF_PATH $IO_DEST
ENV F77 gfortran
ENV F90 gfortran
ENV CC gcc
ENV FC gfortran
ENV MPIFC mpif90
ENV MPIF77 mpif77
ENV MPIF90 mpif90
ENV MPICC mpicc
ENV CFLAGS -I$IO_DEST/include
ENV FFLAGS -I$IO_DEST/include
ENV LDFLAGS -L$IO_DEST/lib
#################################################
# Copy the libs
#################################################
COPY MPAS-io-libs.tar.gz $MPAS_PATH
WORKDIR $MPAS_PATH
RUN tar zxvf MPAS-io-libs.tar.gz
RUN rm MPAS-io-libs.tar.gz
#################################################
# Build netcdf-c
#################################################
WORKDIR $MPAS_LIBS_PATH
RUN mkdir netcdf-c-build
WORKDIR $MPAS_LIBS_PATH/netcdf-c-build
RUN $NETCDF_C_SOURCE/configure --prefix=$IO_DEST --disable-shared --disable-netcdf-4 --disable-dap --disable-utilities || exit 1;
RUN make || exit 1;
RUN make install
#################################################
# Build netcdf-f
#################################################
WORKDIR $MPAS_LIBS_PATH
RUN mkdir netcdf-f-build
WORKDIR $MPAS_LIBS_PATH/netcdf-f-build
RUN $NETCDF_F_SOURCE/configure --prefix=$IO_DEST --disable-shared || exit 1;
RUN make || exit 1;
RUN make install
#################################################
# Build pio
#################################################
WORKDIR $PIO_SOURCE
RUN ./configure --prefix=$IO_DEST --disable-pnetcdf --disable-mpiio || exit 1;
RUN make clean || exit 1;
RUN make || exit 1;
RUN make install
#################################################
# clean
#################################################
WORKDIR $MPAS_LIBS_PATH
RUN rm -rf netcdf-c-build netcdf-f-build