Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 39 additions & 50 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@ ARG starenv=root6
# Pick one from [gcc485, gcc11]
ARG compiler=gcc485

# Pick one from [os, bc]
ARG baseimg=bc

ARG baseimg_os=scientificlinux/sl:7
ARG baseimg_bc=ghcr.io/star-bnl/star-spack:buildcache

# This implements a switch for /opt/buildcache in buildcache-stage
FROM ${baseimg_os} AS baseimg_os-stage
RUN mkdir -p /opt/buildcache # create dummy dir
FROM ${baseimg_bc} AS baseimg_bc-stage
FROM baseimg_${baseimg}-stage AS buildcache-stage
# Install common packages
FROM ${baseimg_os} AS base-stage

RUN sed -i 's/scientificlinux.org\/linux\/scientific\//scientificlinux.org\/linux\/scientific\/obsolete\//g' /etc/yum.repos.d/*
RUN yum install -y git unzip make patch perl perl-Data-Dumper


# Install gcc485 (default)
FROM ${baseimg_os} AS gcc485-prep-stage
FROM base-stage AS gcc485-prep-stage
RUN yum install -y gcc gcc-c++ gcc-gfortran \
&& mkdir -p /opt/rh # create dummy dir

# Install gcc11
FROM ${baseimg_os} AS gcc11-prep-stage
RUN curl -O http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm \
&& rpm -ivh centos-release-scl-rh-2-3.el7.centos.noarch.rpm \
&& yum install -y devtoolset-11 \
&& echo "source /opt/rh/devtoolset-11/enable" >> /etc/bashrc
FROM base-stage AS gcc11-prep-stage

COPY <<-"EOF" /etc/yum.repos.d/rocky-sclo-rh.repo
[rocky-sclo-rh]
name=Rocky Vault CentOS 7 SCLo rh
baseurl=https://dl.rockylinux.org/vault/centos/7/sclo/$basearch/rh/
enabled=1
gpgcheck=0
EOF

RUN yum install -y devtoolset-11 \
&& echo "source /opt/rh/devtoolset-11/enable" >> /etc/profile.d/z01_setup_compiler.sh


FROM ${compiler}-prep-stage AS build-stage

# The shell command allows to pick up the changes in /etc/bashrc
SHELL ["/bin/bash", "--login", "-c"]
SHELL ["/bin/bash", "-l", "-c"]

RUN yum install -y git unzip make patch \
perl perl-Data-Dumper \
lapack-static blas-static imake motif-devel
RUN yum install -y lapack-static blas-static imake motif-devel

# Install cernlib
RUN mkdir /cern && cd /cern \
Expand All @@ -52,40 +52,30 @@ RUN mkdir /cern && cd /cern \
COPY . /star-spack

RUN mkdir -p /star-spack/spack && curl -sL https://github.com/spack/spack/archive/v0.18.1.tar.gz | tar -xz --strip-components 1 -C /star-spack/spack
RUN echo "[ -f /star-spack/setup.sh ] && source /star-spack/setup.sh" > /etc/profile.d/z09_setup_spack.sh

ARG starenv

COPY --from=buildcache-stage /opt/buildcache /opt/buildcache
RUN mkdir -p /spack-buildcache

COPY --chmod=0755 <<-"EOF" dostarenv.sh
#!/bin/bash -l
set -e
source /star-spack/setup.sh
rm -f $HOME/.spack/mirrors.yaml
spack compiler add $(dirname $(which gcc))
spack mirror add buildcache /opt/buildcache
spack buildcache update-index -d /opt/buildcache
spack mirror add --scope site spack-buildcache file:///spack-buildcache || true
spack mirror list
spack config add 'config:install_tree:root:/opt/software'
spack env remove -y ${1} || true
spack env create ${1} /star-spack/environments/${1}.yaml
spack env activate ${1}
spack --insecure install --no-check-signature --reuse
spack --insecure install --no-check-signature || true
spack buildcache create --allow-root --unsigned --force --rebuild-index --directory /spack-buildcache $(spack find --no-groups --format "/{hash}")
spack module tcl refresh -y
spack env deactivate
EOF

COPY <<"EOF" /root/.spack/config.yaml
config:
install_tree:
root: /opt/software
EOF

RUN ./dostarenv.sh star-utils
RUN ./dostarenv.sh star-x86_64-loose
RUN ./dostarenv.sh ${starenv}
# Load only the umbrella star-env module
RUN <<-EOF
source /star-spack/setup.sh
spack -e ${starenv} module tcl loads star-env >> /star-spack/spack/var/spack/environments/${starenv}/loads
EOF
RUN --mount=type=cache,target=/spack-buildcache ./dostarenv.sh star-loose
RUN --mount=type=cache,target=/spack-buildcache ./dostarenv.sh ${starenv}

# Strip all the binaries
RUN find -L /opt/software/* -type f -exec readlink -f '{}' \; | \
Expand All @@ -94,18 +84,23 @@ RUN find -L /opt/software/* -type f -exec readlink -f '{}' \; | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -S

# Load only the umbrella star-env module
RUN spack -e ${starenv} module tcl loads star-env >> /etc/profile.d/z10_load_spack_env_modules.sh


FROM ${baseimg_os} AS starenv-stage

ARG starenv
ARG compiler

SHELL ["/bin/bash", "-l", "-c"]

COPY --from=build-stage /cern /cern
COPY --from=build-stage /etc/bashrc /etc/bashrc
COPY --from=build-stage /etc/profile.d /etc/profile.d
COPY --from=build-stage /opt/software /opt/software
COPY --from=build-stage /star-spack/spack/var/spack/environments/${starenv}/loads /etc/profile.d/z10_load_spack_env_modules.sh
COPY --from=build-stage /star-spack/spack/share/spack/modules/linux-scientific7-x86_64 /opt/linux-scientific7-x86_64
COPY --from=build-stage /star-spack/spack/share/spack/modules/linux-scientific7-x86_64_v3 /opt/linux-scientific7-x86_64

RUN sed -i 's/scientificlinux.org\/linux\/scientific\//scientificlinux.org\/linux\/scientific\/obsolete\//g' /etc/yum.repos.d/*
RUN yum update -q -y \
&& yum install -y \
binutils gcc gcc-c++ gcc-gfortran \
Expand All @@ -116,11 +111,6 @@ RUN yum update -q -y \
environment-modules \
&& yum clean all

RUN curl -O http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm \
&& rpm -ivh centos-release-scl-rh-2-3.el7.centos.noarch.rpm \
&& yum install -y devtoolset-11 \
&& yum clean all

ENV MODULEPATH=/opt/linux-scientific7-x86_64
ENV USE_64BITS=1
ENV CERN=/cern
Expand All @@ -134,8 +124,7 @@ ENV LIBPATH+=:/lib64:/lib
# Empty dummy directories checked by cons
RUN mkdir $OPTSTAR/lib && mkdir $OPTSTAR/include
# Some STAR packages include mysql.h as <mysql/mysql.h>
RUN source /etc/profile \
&& ln -s `mysql_config --variable=pkgincludedir` /usr/include/mysql
RUN ln -s $(mysql_config --variable=pkgincludedir) /usr/include/mysql

COPY --chmod=0755 <<-"EOF" /opt/entrypoint.sh
#!/bin/bash -l
Expand Down
6 changes: 6 additions & 0 deletions environments/concretizer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
concretizer:
unify: true
reuse: true
targets:
granularity: generic
host_compatible: true
8 changes: 5 additions & 3 deletions environments/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ packages:
eigen:
version: [3.3.9]
geant4:
version: [10.4.0]
version: [10.5.1]
geant4-vmc:
version: [4-0-p3]
version: [5-0-p5]
genfit:
version: [02-00-00]
variants: +rave
Expand All @@ -39,10 +39,12 @@ packages:
variants: cxxstd=11
version: [5.7.27]
openblas:
version: [0.3.10]
version: [0.3.20]
rave:
version: ['2020-08-11']
root:
variants: +vc +fftw +mlp +mysql +pythia6 +roofit +tmva +vdt +spectrum
star-table:
version: [0.1.1]
vmc:
version: [1-0-p3]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ spack:
include:
- $spack/../environments/packages.yaml
- $spack/../environments/modules.yaml
- $spack/../environments/concretizer.yaml
config:
build_stage:
- $spack/var/spack/stage
specs:
- catch2
- ccache ^zstd+programs
- cmake
- git
- [email protected] ^[email protected]
- [email protected] ^[email protected]
- [email protected] ^[email protected]
Expand Down
19 changes: 0 additions & 19 deletions environments/star-utils.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions environments/star-x86-root-6.24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ spack:
include:
- $spack/../environments/packages.yaml
- $spack/../environments/modules.yaml
- $spack/../environments/concretizer.yaml
specs:
- boost
- eigen
Expand All @@ -22,8 +23,6 @@ spack:
- [email protected]
- [email protected]
- [email protected]
concretizer:
unify: true
packages:
all:
target: [x86]
Expand Down
13 changes: 5 additions & 8 deletions environments/star-x86_64-root-5.34.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
include:
- $spack/../environments/packages.yaml
- $spack/../environments/modules.yaml
- $spack/../environments/concretizer.yaml
config:
build_stage:
- $spack/var/spack/stage
specs:
- boost
- eigen
- fastjet
- genfit@b496504a
- gsl
- kfparticle
- kitrack
- libxml2
- log4cxx
- mysql
- rave
- [email protected] ~python +table
- star-env@0.3.0
- star-env@0.4.0
- [email protected]
concretizer:
unify: true
packages:
all:
target: [x86_64]
Expand Down
18 changes: 9 additions & 9 deletions environments/star-x86_64-root-6.24.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
include:
- $spack/../environments/packages.yaml
- $spack/../environments/modules.yaml
- $spack/../environments/concretizer.yaml
config:
build_stage:
- $spack/var/spack/stage
specs:
- boost
- eigen
- fastjet
- geant4
- geant4-vmc
- genfit
- gsl
- kfparticle
- kitrack
- libxml2
- log4cxx
- mysql
- rave
- [email protected] ~vc ~vmc
- star-env@0.3.0
- star-table@0.1.1
- star-env@0.4.0
- star-table
- [email protected]
concretizer:
unify: true
- vmc
packages:
all:
target: [x86_64]
Expand Down
7 changes: 6 additions & 1 deletion packages/star-env/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ class StarEnv(BundlePackage):

homepage = "https://github.com/star-bnl/star-spack/"

version('0.3.0')
version('0.4.0')

depends_on('boost')
depends_on('eigen')
depends_on('fastjet')
depends_on('geant4', when='[email protected]:')
depends_on('geant4-vmc', when='[email protected]:')
depends_on('genfit')
depends_on('gsl')
depends_on('kitrack')
Expand All @@ -23,9 +25,12 @@ class StarEnv(BundlePackage):
depends_on('rave')
depends_on('root')
depends_on('[email protected]')
depends_on('vmc', when='[email protected]:')
depends_on('star-table', when='[email protected]:')
depends_on('zlib')

def setup_run_environment(self, env):
# Set env variable used by STAR cons
env.set('USE_64BITS', '0' if self.spec.target == 'x86' else '1')
if self.spec['root'].version > Version('6.16.00'):
env.prepend_path('CPATH', self.spec['vmc'].prefix.include.vmc)
Loading