Commit e4edeefb authored by Clemens Lange's avatar Clemens Lange
Browse files

Install CMSSW into /cvmfs/cms.cern.ch, also making the location configurable

parent ecf15456
......@@ -10,6 +10,7 @@ LABEL maintainer="Clemens Lange <clemens.lange@cern.ch>"
ARG SCRAM_ARCH=slc6_amd64_gcc481
ARG CMSSW_VERSION=CMSSW_7_1_25_patch5
ARG CMS_INSTALL_DIR=/cvmfs/cms.cern.ch
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
......@@ -31,10 +32,10 @@ USER cmsinst
WORKDIR /opt/cms
RUN wget -O /opt/cms/bootstrap.sh http://cmsrep.cern.ch/cmssw/repos/bootstrap.sh \
&& sh /opt/cms/bootstrap.sh setup -r cms -architecture ${SCRAM_ARCH} -server cmsrep.cern.ch \
&& sh /opt/cms/bootstrap.sh setup -r cms -architecture ${SCRAM_ARCH} -server cmsrep.cern.ch -path ${CMS_INSTALL_DIR} \
&& if [[ $SCRAM_ARCH = "slc5"* ]] || [[ $SCRAM_ARCH = "slc6"* ]]; \
then \
/opt/cms/common/cmspkg -a ${SCRAM_ARCH} install -y cms+local-cern-siteconf+sm111124; \
${CMS_INSTALL_DIR}/common/cmspkg -a ${SCRAM_ARCH} install -y cms+local-cern-siteconf+sm111124; \
else \
wget -q https://github.com/cms-sw/siteconf/archive/master.tar.gz \
&& tar -xzf master.tar.gz \
......@@ -46,32 +47,33 @@ RUN wget -O /opt/cms/bootstrap.sh http://cmsrep.cern.ch/cmssw/repos/bootstra
else \
export BASE_VERSION=${CMSSW_VERSION}; \
fi \
&& /opt/cms/common/cmspkg -a ${SCRAM_ARCH} install -y cms+cmssw+${BASE_VERSION} \
&& ${CMS_INSTALL_DIR}/common/cmspkg -a ${SCRAM_ARCH} install -y cms+cmssw+${BASE_VERSION} \
&& if [[ $CMSSW_VERSION = *"patch"* ]]; \
then \
/opt/cms/common/cmspkg -a ${SCRAM_ARCH} install -y cms+cmssw-patch+${CMSSW_VERSION}; \
${CMS_INSTALL_DIR}/common/cmspkg -a ${SCRAM_ARCH} install -y cms+cmssw-patch+${CMSSW_VERSION}; \
fi \
&& /opt/cms/common/cmspkg -a ${SCRAM_ARCH} clean
&& ${CMS_INSTALL_DIR}/common/cmspkg -a ${SCRAM_ARCH} clean
RUN if [[ $SCRAM_ARCH = "slc5"* ]] || [[ $SCRAM_ARCH = "slc6"* ]]; \
then \
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:${LD_LIBRARY_PATH} \
git clone https://github.com/cms-sw/cms-common.git \
&& sed -i -e 's|@CMS_PREFIX@|/opt/cms|g;s|@SCRAM_ARCH@|'"$SCRAM_ARCH"'|' \
&& sed -i -e 's|@CMS_PREFIX@|'"$CMS_INSTALL_DIR"'|g;s|@SCRAM_ARCH@|'"$SCRAM_ARCH"'|' \
cms-common/cmsset_default.* \
&& cp -f cms-common/cmsset_default.sh /opt/cms/ \
&& cp -f cms-common/cmsset_default.csh /opt/cms/ \
&& cp -f cms-common/cmsset_default.sh ${CMS_INSTALL_DIR}/ \
&& cp -f cms-common/cmsset_default.csh ${CMS_INSTALL_DIR}/ \
&& rm -rf cms-common; \
fi
USER root
RUN /bin/cp -f /opt/cms/cmsset_default.sh /etc/profile.d/
RUN /bin/cp -f ${CMS_INSTALL_DIR}/cmsset_default.sh /etc/profile.d/
USER cmsusr
WORKDIR /home/cmsusr
ENV CMSSW_VERSION=${CMSSW_VERSION}
ENV SCRAM_ARCH=${SCRAM_ARCH}
ENV CMS_INSTALL_DIR=${CMS_INSTALL_DIR}
ADD entrypoint.sh /opt/cms/entrypoint.sh
RUN sudo chmod 755 /opt/cms/entrypoint.sh && \
sudo chown -R cmsusr /home/cmsusr && \
......
......@@ -2,11 +2,12 @@
set -e
echo "Setting up ${CMSSW_VERSION}"
source /opt/cms/cmsset_default.sh
source ${CMS_INSTALL_DIR}/cmsset_default.sh
scramv1 project CMSSW ${CMSSW_VERSION}
cd ${CMSSW_VERSION}/src
eval `scramv1 runtime -sh`
echo "CMSSW should now be available."
echo "This is a standalone image for ${CMSSW_VERSION} ${SCRAM_ARCH}."
export LD_LIBRARY_PATH=${UPDATE_PATH}/lib:${UPDATE_PATH}/lib64:${LD_LIBRARY_PATH}
export PATH=${UPDATE_PATH}/bin:${PATH}
......@@ -18,9 +19,9 @@ ver=( $(echo ${CMSSW_VERSION} | tr '_', '\n') )
if [[ ${ver[1]}${ver[2]} -ge 62 ]]
then
sudo sed -i '/import os/a import pwd' /opt/cms/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/pkg.py
sudo sed -i 's/os.getlogin()/pwd.getpwuid(os.geteuid())[0]/g' /opt/cms/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/pkg.py
sudo sed -i 's/os.getlogin()/pwd.getpwuid(os.geteuid())[0]/g' /opt/cms/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/utils.py
sudo sed -i '/import os/a import pwd' ${CMS_INSTALL_DIR}/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/pkg.py
sudo sed -i 's/os.getlogin()/pwd.getpwuid(os.geteuid())[0]/g' ${CMS_INSTALL_DIR}/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/pkg.py
sudo sed -i 's/os.getlogin()/pwd.getpwuid(os.geteuid())[0]/g' ${CMS_INSTALL_DIR}/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/utils.py
fi
exec "$@"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment