Commit 5d35f540 authored by Thomas Mc Cauley's avatar Thomas Mc Cauley
Browse files

Merge branch 'opt_cvmfs' into 'master'

Move standalone installation from `/opt/cms` to `/cvmfs/cms.cern.ch`

Closes #12

See merge request cms-cloud/cmssw-docker!54
parents 00a252fe e4edeefb
Pipeline #3897630 failed with stage
in 2 minutes and 35 seconds
...@@ -10,6 +10,7 @@ LABEL maintainer="Clemens Lange <clemens.lange@cern.ch>" ...@@ -10,6 +10,7 @@ LABEL maintainer="Clemens Lange <clemens.lange@cern.ch>"
ARG SCRAM_ARCH=slc6_amd64_gcc481 ARG SCRAM_ARCH=slc6_amd64_gcc481
ARG CMSSW_VERSION=CMSSW_7_1_25_patch5 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 # Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE ARG BUILD_DATE
...@@ -31,10 +32,10 @@ USER cmsinst ...@@ -31,10 +32,10 @@ USER cmsinst
WORKDIR /opt/cms WORKDIR /opt/cms
RUN wget -O /opt/cms/bootstrap.sh http://cmsrep.cern.ch/cmssw/repos/bootstrap.sh \ 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"* ]]; \ && if [[ $SCRAM_ARCH = "slc5"* ]] || [[ $SCRAM_ARCH = "slc6"* ]]; \
then \ 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 \ else \
wget -q https://github.com/cms-sw/siteconf/archive/master.tar.gz \ wget -q https://github.com/cms-sw/siteconf/archive/master.tar.gz \
&& tar -xzf 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 ...@@ -46,32 +47,33 @@ RUN wget -O /opt/cms/bootstrap.sh http://cmsrep.cern.ch/cmssw/repos/bootstra
else \ else \
export BASE_VERSION=${CMSSW_VERSION}; \ export BASE_VERSION=${CMSSW_VERSION}; \
fi \ 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"* ]]; \ && if [[ $CMSSW_VERSION = *"patch"* ]]; \
then \ 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 \ 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"* ]]; \ RUN if [[ $SCRAM_ARCH = "slc5"* ]] || [[ $SCRAM_ARCH = "slc6"* ]]; \
then \ then \
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:${LD_LIBRARY_PATH} \ LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:${LD_LIBRARY_PATH} \
git clone https://github.com/cms-sw/cms-common.git \ 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.* \ cms-common/cmsset_default.* \
&& cp -f cms-common/cmsset_default.sh /opt/cms/ \ && cp -f cms-common/cmsset_default.sh ${CMS_INSTALL_DIR}/ \
&& cp -f cms-common/cmsset_default.csh /opt/cms/ \ && cp -f cms-common/cmsset_default.csh ${CMS_INSTALL_DIR}/ \
&& rm -rf cms-common; \ && rm -rf cms-common; \
fi fi
USER root 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 USER cmsusr
WORKDIR /home/cmsusr WORKDIR /home/cmsusr
ENV CMSSW_VERSION=${CMSSW_VERSION} ENV CMSSW_VERSION=${CMSSW_VERSION}
ENV SCRAM_ARCH=${SCRAM_ARCH} ENV SCRAM_ARCH=${SCRAM_ARCH}
ENV CMS_INSTALL_DIR=${CMS_INSTALL_DIR}
ADD entrypoint.sh /opt/cms/entrypoint.sh ADD entrypoint.sh /opt/cms/entrypoint.sh
RUN sudo chmod 755 /opt/cms/entrypoint.sh && \ RUN sudo chmod 755 /opt/cms/entrypoint.sh && \
sudo chown -R cmsusr /home/cmsusr && \ sudo chown -R cmsusr /home/cmsusr && \
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
set -e set -e
echo "Setting up ${CMSSW_VERSION}" echo "Setting up ${CMSSW_VERSION}"
source /opt/cms/cmsset_default.sh source ${CMS_INSTALL_DIR}/cmsset_default.sh
scramv1 project CMSSW ${CMSSW_VERSION} scramv1 project CMSSW ${CMSSW_VERSION}
cd ${CMSSW_VERSION}/src cd ${CMSSW_VERSION}/src
eval `scramv1 runtime -sh` eval `scramv1 runtime -sh`
echo "CMSSW should now be available." 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 LD_LIBRARY_PATH=${UPDATE_PATH}/lib:${UPDATE_PATH}/lib64:${LD_LIBRARY_PATH}
export PATH=${UPDATE_PATH}/bin:${PATH} export PATH=${UPDATE_PATH}/bin:${PATH}
...@@ -18,9 +19,9 @@ ver=( $(echo ${CMSSW_VERSION} | tr '_', '\n') ) ...@@ -18,9 +19,9 @@ ver=( $(echo ${CMSSW_VERSION} | tr '_', '\n') )
if [[ ${ver[1]}${ver[2]} -ge 62 ]] if [[ ${ver[1]}${ver[2]} -ge 62 ]]
then 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 '/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' /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' ${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' /opt/cms/${SCRAM_ARCH}/cms/cmssw/${CMSSW_VERSION}/python/FWCore/Skeletons/utils.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 fi
exec "$@" 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