-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.base
214 lines (183 loc) · 7.57 KB
/
Dockerfile.base
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#
# Created by Doug Cowen, Penn State, 13Jul2018.
# Thanks to Justin Lanfranchi (Penn State grad student on IceCube)
#
# Updated by Morgan Askins, Aug-2018
#
# Use ubuntu 14.04 as the operating system
#
FROM ubuntu:14.04
# install several basic packages available in ubuntu
# Combining in a single run to reduce layers
RUN apt update \
&& apt install -y build-essential python-dev wget vim emacs\
libx11-dev libxpm-dev libxft-dev \
libxext-dev libqt4-dev scons git gfortran python-pip \
&& apt-get autoclean \
&& apt-get clean
# The SHELL command sets the -l option to load profile files so that the proper PATH is set. I think.
SHELL ["/bin/sh", "-lc"]
# Make /src the current working directory for subsequent COPY and RUN commands
WORKDIR /src
#
#
# For reasons unclear, copying the root and/or geant tarballs via wget can be very slow from
# within a building docker image. Also, there may be a need to rebuild the docker image from time to time.
# It is therefore more efficient to copy the large tarballs to the same directory that houses this file, and
# then use the Dockerfile COPY command to grab them for further processing.
#
# It is also more efficient to unpack the big tarballs right here at the beginning, so that any
# subsequent changes in this Dockerfile will not result in Docker redoing the unpacking. (Docker
# conveniently caches what it did in previous "docker build" commands.)
#
# MAKE SURE THAT THE CURRENT DIRECTORY HAS THE root AND geant TARBALLS IN IT.
#
ARG rootinstall=./root.tar.gz
COPY ${rootinstall} /src/
RUN tar -zxf ${rootinstall} && rm -f ${rootinstall}
ARG geant=geant.tar.gz
COPY ${geant} /src/
RUN mkdir -p /src/geant4 && tar -xzf ${geant} -C /src/geant4 --strip-components=1 \
&& rm -f ${geant}
# first set of python dependencies -- #
RUN pip install numpy
RUN pip install --user docopt
# ROOT 5.34.32 -- #
WORKDIR /src/root
RUN ./configure --enable-python --enable-minuit2 && make -j8
# root python dependency
ENV ROOTSYS /src/root
RUN pip install root_numpy
# cmake >= 3.3 (required for geant4 10.03.p02)
#
# Note that we copy this via wget from within the Docker build since it is small.
#
WORKDIR /src
RUN wget https://cmake.org/files/v3.11/cmake-3.11.1-Linux-x86_64.sh && \
# Options for following command prevent it from requiring interactive responses
sh cmake-3.11.1-Linux-x86_64.sh --skip-license --include-subdir && \
export PATH=$PATH:/src/cmake-3.11.1-Linux-x86_64/bin && \
rm -f cmake-3.11.1-Linux-x86_64.sh
# Geant4 10.03.p02 -- #
# Move Geant4 data files into data dir for installation
# NOTE: The following assumes that you have downloaded all these data files into
# the current working directory (the one with this Dockerfile in it)
ARG g4build=/src/geant4-build
ARG g4data=${g4build}/share/data
RUN mkdir -p ${g4data}
COPY G4ABLA.tar.gz ${g4data}/
COPY G4EMLOW.tar.gz ${g4data}/
COPY G4ENSDFSTATE.tar.gz ${g4data}/
COPY G4NDL.tar.gz ${g4data}/
COPY G4NEUTRONXS.tar.gz ${g4data}/
COPY G4PhotonEvaporation.tar.gz ${g4data}/
COPY G4PII.tar.gz ${g4data}/
COPY G4RadioactiveDecay.tar.gz ${g4data}/
COPY G4RealSurface.tar.gz ${g4data}/
COPY G4SAIDDATA.tar.gz ${g4data}/
COPY G4TENDL.tar.gz ${g4data}/
WORKDIR ${g4data}
RUN mkdir -p G4ABLA && tar zxf G4ABLA.tar.gz -C G4ABLA --strip-components=1 &&\
mkdir -p G4EMLOW && tar zxf G4EMLOW.tar.gz -C G4EMLOW --strip-components=1 &&\
mkdir -p G4ENSDFSTATE && tar zxf G4ENSDFSTATE.tar.gz -C G4ENSDFSTATE --strip-components=1 &&\
mkdir -p G4NDL && tar zxf G4NDL.tar.gz -C G4NDL --strip-components=1 &&\
mkdir -p G4NEUTRONXS && tar zxf G4NEUTRONXS.tar.gz -C G4NEUTRONXS --strip-components=1 &&\
mkdir -p G4PhotonEvaporation && tar zxf G4PhotonEvaporation.tar.gz -C G4PhotonEvaporation --strip-components=1 &&\
mkdir -p G4PII && tar zxf G4PII.tar.gz -C G4PII --strip-components=1 &&\
mkdir -p G4RadioactiveDecay && tar zxf G4RadioactiveDecay.tar.gz -C G4RadioactiveDecay --strip-components=1 &&\
mkdir -p G4RealSurface && tar zxf G4RealSurface.tar.gz -C G4RealSurface --strip-components=1 &&\
mkdir -p G4SAIDDATA && tar zxf G4SAIDDATA.tar.gz -C G4SAIDDATA --strip-components=1 &&\
mkdir -p G4TENDL && tar zxf G4TENDL.tar.gz -C G4TENDL --strip-components=1 &&\
rm -f ${g4data}/G4ABLA.tar.gz &&\
rm -f ${g4data}/G4EMLOW.tar.gz &&\
rm -f ${g4data}/G4ENSDFSTATE.tar.gz &&\
rm -f ${g4data}/G4NDL.tar.gz &&\
rm -f ${g4data}/G4NEUTRONXS.tar.gz &&\
rm -f ${g4data}/G4PhotonEvaporation.tar.gz &&\
rm -f ${g4data}/G4PII.tar.gz &&\
rm -f ${g4data}/G4RadioactiveDecay.tar.gz &&\
rm -f ${g4data}/G4RealSurface.tar.gz &&\
rm -f ${g4data}/G4SAIDDATA.tar.gz &&\
rm -f ${g4data}/G4TENDL.tar.gz
WORKDIR ${g4build}
#
# Do not use "-DGEANT4_INSTALL_DATA=ON" to enable auto download & install in cmake
# since the files are already here (see just above)
#
RUN /src/cmake-3.11.1-Linux-x86_64/bin/cmake -DCMAKE_INSTALL_PREFIX=${g4build} /src/geant4 -DGEANT4_USE_SYSTEM_EXPAT=OFF -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_QT=ON
RUN make -j8 && make install
#
# Manually set all the environment variables defined in geant4.sh and thisroot.sh
# Note that if any of the pathnames above are changed, the env vars below may also change,
# and will need to be re-set manually
#
# Geant env vars from geant4.sh
ENV G4LEVELGAMMADATA=${g4data}/G4PhotonEvaporation
ENV G4NEUTRONXSDATA=${g4data}/G4NEUTRONXS
ENV G4LEDATA=${g4data}/G4EMLOW
ENV G4NEUTRONHPDATA=${g4data}/G4NDL
ENV G4ENSDFSTATEDATA=${g4data}/G4ENSDFSTATE
ENV G4RADIOACTIVEDATA=${g4data}/G4RadioactiveDecay
ENV G4ABLADATA=${g4data}/G4ABLA
ENV G4PIIDATA=${g4data}/G4PII
ENV G4SAIDXSDATA=${g4data}/G4SAIDDATA
ENV G4REALSURFACEDATA=${g4data}/G4RealSurface
# Root env vars from thisroot.sh
ENV MANPATH=/src/root/man:
ENV LIBPATH=/src/root/lib
ENV DYLD_LIBRARY_PATH=/src/root/lib
ENV PYTHONPATH=/src/root/lib
ENV SHLIB_PATH=/src/root/lib
#
# PATHs
#
ENV LD_LIBRARY_PATH=/src/root/lib:${g4build}/lib
ENV PATH=/src/root/bin:${g4build}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Build rat-pac
WORKDIR /src
RUN git clone https://github.com/AIT-WATCHMAN/rat-pac.git rat-pac
WORKDIR /src/rat-pac
RUN . ./configure
#RUN . ./env.sh
#
# Add/Update env vars from env.sh here:
#
ENV LD_LIBRARY_PATH=/src/rat-pac/lib:/src/root/lib:${g4build}/lib
ENV PATH=/src/rat-pac/bin:/src/root/bin:${g4build}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV GLG4DATA=/src/rat-pac/data
ENV DYLD_LIBRARY_PATH=/src/rat-pac/lib:/src/root/lib
ENV PYTHONPATH=/src/rat-pac/python:/src/root/lib
ENV RATROOT=/src/rat-pac
#
# Some special code to handle lfariadne.F
#
RUN mkdir -p build/linuxx8664gcc/fit/bonsai
RUN gfortran -c src/fit/bonsai/lfariadne.F -o build/linuxx8664gcc/fit/bonsai/lfariadne.o
RUN CXXFLAGS=-std=c++11 scons
WORKDIR /src/rat-pac/tools/bonsai
# Once we have fix in github
#RUN make
# Build watchmakers
# N.B.: env_wm.sh does not correctly set up the alias "watch"
# Should read: alias watch='python /src/watchmakers/watchmakers.py'
WORKDIR /src
RUN git clone https://github.com/AIT-WATCHMAN/watchmakers.git
WORKDIR /src/watchmakers
RUN ./configure
#
#
# Add env vars from env_wm.sh and re-set the alias "watch" below:
ENV PATH=/src/watchmakers:/src/rat-pac/bin:/src/root/bin:${g4build}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PYTHONPATH=/src/watchmakers:/src/rat-pac/python:/src/root/lib
ENV WATCHENV=/src/watchmakers
RUN alias watch='python /src/watchmakers/watchmakers.py'
#
# Geant env var needed by watchmakers
#
ENV G4INSTALL=${g4build}
#
# This is needed, but can probably be moved away from the very end of this build script.
#
RUN pip install rootpy
WORKDIR /root
COPY Dockerfile.base Dockerfile.base