1- FROM scientificlinux/sl:7 AS build-stage
2-
3- WORKDIR /workdir
1+ # Pull SL7 image by digest (immutable identifier)
2+ FROM scientificlinux/sl@sha256:437d3402c454319a5443bb5a99844c8d6f454828c59dcfb2730f1bdff8f2f48c AS prep-stage
43
54SHELL ["/bin/bash", "-c"]
65ENV LC_ALL=en_US.UTF-8
76
8- # epel repo is for python pip only
97RUN yum update -q -y \
10- && yum install -y epel-release \
118 && yum install -y \
12- binutils gcc gcc-c++ gcc-gfortran xorg-x11-proto-devel \
9+ gcc gcc-c++ gcc-gfortran \
1310 git bzip2 unzip file which make imake patch \
14- bison byacc flex flex-devel libcurl-devel \
15- perl perl-Data-Dumper perl-Env perl-Digest-MD5 \
11+ flex-devel libcurl-devel \
12+ perl perl-Data-Dumper \
1613 lapack-static blas-static \
1714 libX11-devel libXext-devel libXpm-devel openmotif-devel \
18- python python-pip \
19- environment-modules \
2015 && yum clean all
2116
22- # Install extra python modules used by the STAR software
23- RUN pip install pyparsing
17+ # Install cernlib
18+ RUN mkdir /cern && cd /cern \
19+ && curl -sL https://github.com/psilib/cernlib/archive/centos7.tar.gz | tar -xz --strip-components 1 \
20+ && ./build_cernlib.sh \
21+ && mv /usr/lib64/libblas.a /cern/2006/lib/libblas.a \
22+ && mv /usr/lib64/liblapack.a /cern/2006/lib/liblapack3.a \
23+ && ln -s 2006 /cern/pro \
24+ && rm -fr /cern/2006/src /cern/2006/build
2425
2526RUN mkdir -p star-spack \
26- && curl -sL https://github.com/star-bnl/star-spack/archive/9299449b078f4f0ad0d6fd1b0a220449d38b340d .tar.gz | tar -xz --strip-components 1 -C star-spack \
27+ && curl -sL https://github.com/star-bnl/star-spack/archive/fba3a3ffbafc0c77fa46085d807b717ca807f345 .tar.gz | tar -xz --strip-components 1 -C star-spack \
2728 && curl -sL https://github.com/spack/spack/archive/010e5761d6631eae102d1eec87e5e74a0e16ed82.tar.gz | tar -xz --strip-components 1 -C star-spack/spack
2829
2930RUN source star-spack/setup.sh \
30- && spack env create star-env-root5 star-spack/environments/star-x86_64-root-5.34.38-container.yaml \
31- && spack env activate star-env-root5 \
31+ && spack env create star-env-root star-spack/environments/star-x86_64-root-5.34.38-container.yaml \
32+ && spack env activate star-env-root \
3233 && spack install -j 5 --fail-fast \
33- && spack gc -y
34+ && spack gc -y \
35+ && spack clean --all \
36+ && spack uninstall --force -y llvm \
37+ # Create star-spack/spack/var/spack/environments/star-env-root/loads
38+ && spack -e star-env-root env loads
3439
35- # Install CERNLIB
36- RUN mkdir /cern && cd /cern \
37- && curl -sL https://github.com/psilib/cernlib/archive/centos7.tar.gz | tar -xz --strip-components 1 \
38- && ./build_cernlib.sh \
39- && cd /cern/2006/lib \
40- && ln -s /usr/lib64/libblas.a libblas.a \
41- && ln -s /usr/lib64/liblapack.a liblapack3.a \
42- && cd /cern \
43- && ln -s 2006 pro \
44- && rm -fr /cern/2006/src /cern/2006/build /tmp/*
40+ # Strip all the binaries
41+ RUN find -L /opt/software/* -type f -exec readlink -f '{}' \; | \
42+ xargs file -i | \
43+ grep 'charset=binary' | \
44+ grep 'x-executable\|x-archive\|x-sharedlib' | \
45+ awk -F: '{print $1}' | xargs strip -S
46+
47+
48+ FROM scientificlinux/sl@sha256:437d3402c454319a5443bb5a99844c8d6f454828c59dcfb2730f1bdff8f2f48c AS base-stage
49+
50+ SHELL ["/bin/bash", "-c"]
51+ ENV LC_ALL=en_US.UTF-8
52+
53+ COPY --from=prep-stage /opt/software /opt/software
54+ COPY --from=prep-stage /cern /cern
55+ COPY --from=prep-stage /star-spack/spack/var/spack/environments/star-env-root/loads /etc/profile.d/z10_load_spack_env_modules.sh
56+ COPY --from=prep-stage /star-spack/spack/share/spack/modules/linux-scientific7-x86_64 /opt/linux-scientific7-x86_64
57+
58+ # epel repo is for python-pip only
59+ RUN yum update -q -y \
60+ && yum install -y epel-release \
61+ && yum install -y \
62+ binutils gcc gcc-c++ gcc-gfortran \
63+ git bzip2 file which make patch \
64+ bison byacc flex flex-devel libcurl-devel \
65+ perl perl-Env perl-Digest-MD5 \
66+ libX11-devel libXext-devel libXpm-devel libXt-devel \
67+ python python-pip \
68+ environment-modules \
69+ && yum clean all
70+
71+ # Install extra python modules used by the STAR software
72+ RUN pip install pyparsing
73+
74+ ENV MODULEPATH=/opt/linux-scientific7-x86_64
4575
4676ENV STAR=/star-sw
4777ENV USE_64BITS=1
4878ENV CERN=/cern
4979ENV CERN_LEVEL=pro
5080ENV CERN_ROOT=$CERN/$CERN_LEVEL
51- ENV OPTSTAR=/opt/view
52- ENV STAR_CVS_REF=YYY
53- ENV STAR_HOST_SYS=sl88_gcc789
81+ ENV OPTSTAR=/opt/software
82+ ENV STAR_HOST_SYS=sl79_gcc485
5483ENV NODEBUG=yes
5584ENV STAR_LIB=$STAR/.${STAR_HOST_SYS}/LIB
5685ENV STAR_BIN=$STAR/.${STAR_HOST_SYS}/BIN
57- ENV STAR_SCRIPTS=$STAR/scripts
58- ENV STAR_CGI=$STAR/cgi
59- ENV STAR_MGR=$STAR/mgr
60- ENV STAR_PAMS=$STAR/pams
61- ENV STAR_LEVEL=$STAR_CVS_REF
62- ENV STAR_VERSION=$STAR_CVS_REF
6386ENV STAR_SYS=x8664_sl7
64- ENV PATH=$CERN_ROOT/bin:$STAR_BIN:$STAR_MGR :$PATH
87+ ENV PATH=$CERN_ROOT/bin:$STAR_BIN:$STAR/mgr :$PATH
6588ENV LD_LIBRARY_PATH=$STAR_LIB:$LD_LIBRARY_PATH
66- ENV LIBPATH+=":/lib64:/lib"
89+ ENV LIBPATH+=:/lib64:/lib
90+
91+ ENV MYSQL=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/mysql-5.7.27-pfyt3fwtkubcc5eazmoqfick3lgp67mf
92+ ENV LIBXML2_DIR=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/libxml2-2.9.10-4lxsmpa57bm3xs2cs3xapk3qccxflkfl
93+ ENV FASTJET_DIR=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/fastjet-3.3.3-xj22tput5pd5atejy4igsrtgdtygi74u
94+ ENV GSL_DIR=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/gsl-2.6-ao26bt7pm6xxywo2q7dcmhhg2lp2inx7
6795
6896# Dummy directories checked by cons
6997RUN mkdir $OPTSTAR/lib && mkdir $OPTSTAR/include
98+ RUN ln -s $MYSQL/include /usr/include/mysql
99+
100+
101+ FROM base-stage AS build-stage
70102
71103COPY . /star-sw
72104
@@ -88,16 +120,23 @@ diff --git a/asps/rexe/Conscript b/asps/rexe/Conscript \n\
88120 if ($LIBPATH) { $LIBPATH .= $main::PATH_SEPARATOR; }\n' \
89121 && patch -p1 < root4star_cons.patch
90122
91- RUN source star-spack/setup.sh && spack env activate star-env-root5 \
92- && export MYSQL=`spack location --install-dir mysql` \
93- && export LIBXML2_DIR=`spack location --install-dir libxml2` \
94- && cd /usr/include && ln -s $MYSQL/include mysql \
123+ RUN source /etc/profile \
95124 && cd /star-sw \
96- && cons +asps/staf \
97- && cons +asps/Simulation/agetof \
98125 && cons +StarVMC/Geometry \
99- && cons %GeoTestMaker %Kinematics %OnlTools %StAngleCorrMaker %StDaqClfMaker \
100- %StEEmcPool %StEbye2ptMaker %StEbyePool %StEbyeScaTagsMaker %StFgtPool \
101- %StFtpcV0Maker %StHighptPool %StJetFinder %StRoot/Stv %StRoot/StvMaker \
102- %StRoot/StvSeed %StShadowMaker %StSpinMaker %StStrangePool \
103- %pams/sim/g2r %StRoot/StHbtMaker
126+ && cons %GeoTestMaker %Kinematics %OnlTools %StEEmcPool %StFgtPool %StHighptPool %StJetFinder \
127+ %StRoot/Stv %StRoot/StvMaker %StRoot/StvSeed \
128+ %StShadowMaker %StSpinMaker %StStrangePool %pams/sim/g2r %StRoot/StHbtMaker \
129+ && find /star-sw/.$STAR_HOST_SYS -name *.o -exec rm '{}' \;
130+
131+ RUN install /star-sw/StRoot/macros/.rootrc .
132+
133+ # One might expect the single ENTRYPOINT command below to work but for some
134+ # reason it chokes on a complex command such as
135+ #
136+ # docker run image root4star -b 'bfc.C(10, "opt1", "infile.root")'
137+ #
138+ #ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c"]
139+
140+ RUN install -m 755 <(echo $'#!/bin/sh\n . /etc/profile; exec "$@"') entrypoint.sh
141+ ENTRYPOINT ["./entrypoint.sh"]
142+ CMD ["/bin/bash"]
0 commit comments