-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfilempasio
196 lines (161 loc) · 5.7 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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 PNETCDF_SOURCE $MPAS_LIBS_PATH/parallel-netcdf-1.5.0
ENV PIO_SOURCE $MPAS_LIBS_PATH/pio1_7_1/pio
ENV NETCDF_PATH $IO_DEST
ENV PNETCDF_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
#################################################
# 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 pnetcdf
#################################################
WORKDIR $MPAS_LIBS_PATH
RUN mkdir pnetcdf-build
WORKDIR $MPAS_LIBS_PATH/pnetcdf-build
RUN $PNETCDF_SOURCE/configure --prefix=$IO_DEST --disable-cxx || exit 1;
RUN make
RUN make install
#################################################
# Build pio
#################################################
WORKDIR $PIO_SOURCE
RUN ./configure --prefix=$IO_DEST || 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 pnetcdf-build
# Install MPAS
RUN mkdir $MPAS_LIBS_PATH/MPAS
WORKDIR $MPAS_LIBS_PATH/MPAS
RUN git clone https://github.com/MPAS-Dev/MPAS-Release.git
#RUN wget https://github.com/MPAS-Dev/MPAS-Release/archive/v3.3.tar.gz
#RUN tar zxvf v3.3.tar.gz
WORKDIR $MPAS_LIBS_PATH/MPAS/MPAS-Release
# from make.sh by John Woodring
USER root
RUN ln -s `which python2` python
ENV PATH `pwd`:$PATH
ENV NETCDF $IO_DEST
ENV PNETCDF $IO_DEST
ENV PIO $IO_DEST
ENV CORE ocean
ENV MODE forward
ENV AUTOCLEAN true
# For fixing the bug by adding sync
RUN sed -i '/chmod/ c\ (chmod a+x get_cvmix.sh; sync; ./get_cvmix.sh)' src/core_ocean/Makefile
RUN make gfortran
#################################################
# Input Stack
#################################################
# You can use wget to get the input stack but we
# cannot mount the data volume during the building
# time.
ADD launch.sh $MPAS_PATH
ADD runmpas.sh $MPAS_PATH
ADD machinefile $MPAS_PATH
#CMD chown user:user launch.sh && chown user:user runmpas.sh && chown user:user machinefile
WORKDIR $MPAS_PATH
USER root
# You can also use -v during docker run to mount
# the data volume