diff --git a/.gitignore b/.gitignore index 176904b71c3c7f8f56bc8d292949ad99b49e7151..4fdd9fd10d01c10c12b57ad97abedf0575386365 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,3 @@ -# Compiled Object files -*.slo -*.lo -*.o - -# Compiled Dynamic libraries -*.so -*.dylib - -# Compiled Static libraries -*.lai -*.la -*.a - -# build trees -DEBUG*/* -BUILD*/* -RELEASE*/* -TEST*/* - -# cmake -CMakeCache.txt -CMakeFiles -Makefile -cmake_install.cmake -install_manifest.txt - # vim ~* *.swp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 29f2967928ae1be6bee98d5420dd64ebfbe89178..21f142d400294a0cc78be2ab03b5f8c363f1b5d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,38 +3,60 @@ image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest stages: - phase1 - phase2 + - phase3 -eic_docker: +eic_builder_docker: stage: phase1 tags: - - eic0 docker + - sodium dind script: - - cd containers/docker + - cd containers/builder + - head Dockerfile - make login - make release-cached -eic_singularity: - image: eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest +eic_docker: stage: phase2 tags: - - singularity + - sodium dind + script: + - cd containers/release + - make login + - make release-cached + +eic_builder_singularity: + stage: phase2 + tags: + - sodium dind + only: + - tags + when: manual + script: + - cp containers/builder/eic_builder.def . + - /bin/bash .gitlabci/setup.sh + - /bin/bash .gitlabci/build.sh eic_builder.def + - mkdir -p build + - cp eic_builder.sif build/. + - cp eic_builder.def build/. + artifacts: + paths: + - build/eic_builder.sif + - build/eic_builder.def + +eic_singularity: + stage: phase3 + tags: + - sodium dind only: - tags script: - - cp containers/singularity/eic.def . + - cp containers/release/eic.def . - /bin/bash .gitlabci/setup.sh - /bin/bash .gitlabci/build.sh eic.def - mkdir -p build - cp eic.sif build/. - cp eic.def build/. - - # This is where you can save job artifacts - # https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html - # You can specify the path to containers or the build folder to save. - # Don't forget to save your recipes too! artifacts: paths: - build/eic.sif - build/eic.def - - diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 4bbbabc3d44a4a0ef57de0f5ca17cd1ed963048e..0000000000000000000000000000000000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -## CMake project file for hallac_container - -################################################################################ -## PROJECT: hallac_container -################################################################################ -cmake_minimum_required (VERSION 3.8) -project (eic_container VERSION 1.3.3) - -################################################################################ -## The name of our container -################################################################################ -set(CONTAINER eic-${PROJECT_VERSION}.sif) - -################################################################################ -## CMAKE Settings -################################################################################ -include(cmake/options.cmake) - -################################################################################ -## Subdirectories -################################################################################ - -add_subdirectory(containers) -add_subdirectory(modulefiles) -add_subdirectory(scripts) diff --git a/README.md b/README.md index 7e2c714eee240077cce26c786ed37d3244aca172..280b54ef1ba3d415a07a077472fa54363d1d257a 100644 --- a/README.md +++ b/README.md @@ -15,52 +15,33 @@ cd eic_container modelefile will be installed to `$PREFIX/../../etc/modulefiles`. You can use the `-v` flag to select the version you want to deploy, or omit the flag if you want to install the master build. The recommended stable - release version is `v1.0.4`. + release version is `v2.0.0`. ```bash -./deploy.py -v 1.0.4 <PREFIX> +./deploy.py -v 2.0.0 <PREFIX> ``` + Available flags: +```bash + -v VERSION, --version VERSION + (opt.) project version. Default: current git branch/tag. + -b BIND_PATHS, --bind-path BIND_PATHS + (opt.) extra bind paths for singularity. + -m MODULE_PATH, --module-path MODULE_PATH + (opt.) Root module path where you want to install a + modulefile. D: <prefix>/../../etc/modulefiles + -f, --force Force-overwrite already downloaded container with the same name. + --install-builder BUILDER + (opt.) Install fat builder image, instead of normal + slim image +``` + + 3. To use the container: load the modulefile, and then use the included apps as if they are native apps on your system! -``` +```bash module load eic_container ``` 4. (Advanced) If you need to add additional bind directives for the internal singularity container, you can add them with the `-b` flag. Run `./deploy.py -h` to see a list of all supported options. - - -Installation (throug cmake) ---------------------------- - -*Use of the cmake-based deploy is deprecated, We recommend to use the `deploy.py` method -instead.* - -1. Checkout the repository and create a build directory -``` -git clone https://eicweb.phy.anl.gov/containers/eic_container.git -cd eic_containers && mkdir BUILD && cd BUILD -``` - -2. Configure the install for your environment, providing the appropriate `prefix` and - `module_dir` you want to use. -``` -cmake ../. -DCMAKE_INSTALL_PREFIX=$HOME/stow/development -``` -or -``` -cmake ../. -DCMAKE_INSTALL_PREFIX=<prefix> -DINSTALL_MODULE_DIR=<module_dir> -``` - -3. Download the container and install. -``` -make install -``` - -4. To use the container: load the modulefile, and then use the included apps as if - they are native to your system! -``` -module load eic_container -``` - diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..227cea215648b1af34a87c9acf5b707fe02d2072 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.0.0 diff --git a/cmake/options.cmake b/cmake/options.cmake deleted file mode 100644 index f1efa24b863c4d907c34950b3ab76e794f9733b5..0000000000000000000000000000000000000000 --- a/cmake/options.cmake +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -## CMAKE Settings -################################################################################ -## make sure that the default is RELEASE -if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo." - FORCE) -endif () -## Offer the user the choice of overriding the installation directories -set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries") -set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables") -set(INSTALL_INCLUDE_DIR include/${PROJECT_NAME} CACHE PATH "Installation directory for header files") -set(INSTALL_MODULE_DIR ${CMAKE_INSTALL_PREFIX}/../../etc/modulefiles CACHE PATH "Installation directory for module files") -set(INSTALL_BIND_PATH "/net" "/group" "/cache" "/work" "/volatile" CACHE PATH "Installation singularity bind path") -if(WIN32 AND NOT CYGWIN) - set(DEF_INSTALL_CMAKE_DIR cmake) -else() - set(DEF_INSTALL_CMAKE_DIR lib/cmake/${PROJECT_NAME}) -endif() -set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH - "Installation directory for cmake files") -## Make relative paths absolute (useful when auto-generating cmake configuration -## files) Note: not including INSTALL_BIND_PATH on purpose as we should be giving absolute -## paths anyway -foreach(p LIB BIN INCLUDE CMAKE MODULE) - set(var INSTALL_${p}_DIR) - if(NOT IS_ABSOLUTE "${${var}}") - set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") - endif() -endforeach() -## extra cmake modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - "${PROJECT_SOURCE_DIR}/cmake/") diff --git a/containers/CMakeLists.txt b/containers/CMakeLists.txt deleted file mode 100644 index f388195552ce9fe941247f02a2e24b309cd7abc1..0000000000000000000000000000000000000000 --- a/containers/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -## Download the container -################################################################################ - -set(CONTAINER_SOURCE - "https://eicweb.phy.anl.gov/containers/eic_container/-/jobs/artifacts/v${PROJECT_VERSION}/raw/build/eic.sif?job=eic_singularity") - -add_custom_command(OUTPUT ${CONTAINER} - COMMAND wget ${CONTAINER_SOURCE} -O ${CONTAINER} - COMMENT "Downloading ${CONTAINER}" -) - -################################################################################ -## Global target -################################################################################ -add_custom_target(container ALL - DEPENDS ${CONTAINER}) - -################################################################################ -## Install the container to <prefix>/lib -################################################################################ -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CONTAINER} - DESTINATION "${INSTALL_LIB_DIR}" COMPONENT lib) diff --git a/containers/builder/Dockerfile b/containers/builder/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..95d0ea10f671f65a1fbf8aab542fab42c94eb215 --- /dev/null +++ b/containers/builder/Dockerfile @@ -0,0 +1,59 @@ +# Builder with Argonne EIC software +# +FROM eicweb.phy.anl.gov:4567/containers/image_recipes/eic_spack:1.0.0 + +LABEL maintainer="Sylvester Joosten <sjoosten@anl.gov>" \ + name="eic_builder" \ + group="eic_builder" \ + march="native" \ + basedist="ubuntu" \ + base="ubuntu" + +ENV DOCKERFILE_BASE=ubuntu \ + DOCKERFILE_DISTRO=ubuntu \ + DOCKERFILE_DISTRO_VERSION=20.04 \ + SPACK_ROOT=/opt/spack \ + DEBIAN_FRONTEND=noninteractive \ + CURRENTLY_BUILDING_DOCKER_IMAGE=1 \ + container=docker + +## Ensure an up-to-date custom package list +RUN rm -rf $SPACK_ROOT/np-spack \ + && git clone https://eicweb.phy.anl.gov/EIC/np-spack.git $SPACK_ROOT/np-spack \ + && rm -rf $SPACK_ROOT/np-spack/.git \ + && echo "repos:" > $SPACK_ROOT/etc/spack/repos.yaml \ + && echo " - $SPACK_ROOT/np-spack" >> $SPACK_ROOT/etc/spack/repos.yaml + +## Install the software, building on the existing root environment. +## This is a raw builder image, so no calls to spack gc +## FIXME: eigen should be explicitly added upstream +RUN cd /opt/spack-environment && spack env activate . \ + && spack add npdet@master \ + && spack add eigen \ + && spack install \ + && spack clean -a + +## FIXME: ipython etc should be added upstream +RUN cd /opt/spack-environment && spack env activate . \ + && pip install --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org \ + --no-cache-dir \ + ipython matplotlib scipy + +## Strip the binaries +RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \ + xargs file -i | \ + grep 'charset=binary' | \ + grep 'x-executable\|x-archive\|x-sharedlib' | \ + awk -F: '{print $1}' | xargs strip -s + +# Modifications to the environment that are necessary to run +RUN cd /opt/spack-environment && \ + spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh && \ + echo "export BINARY_TAG=x86_64-linux-gcc9-opt" >> /etc/profile.d/z10_spack_environment.sh + +## make sure we have the entrypoints setup correctly +ENTRYPOINT [] +CMD ["bash", "--rcfile", "/etc/profile", "-l"] +USER 0 +WORKDIR / diff --git a/containers/docker/Makefile b/containers/builder/Makefile similarity index 100% rename from containers/docker/Makefile rename to containers/builder/Makefile diff --git a/containers/docker/config.env b/containers/builder/config.env similarity index 88% rename from containers/docker/config.env rename to containers/builder/config.env index fa20986f7a645e453cafe83ac1c77dbf40c97925..29f4d798964e7eedc430ea94b22a27ce5e1ec9d5 100644 --- a/containers/docker/config.env +++ b/containers/builder/config.env @@ -9,8 +9,8 @@ REG_URL ?= https://$(REG_HOST) # Dockerfile.$(ALT_NAME) --> $(APP_NAME)_${ALT_NAME} ALT_NAME ?= broadwell -APP_NAME = eic_container -REPO_NAME = eic_container +APP_NAME = eic_builder +REPO_NAME = eic_builder DH_ORG = eic diff --git a/containers/builder/eic_builder.def b/containers/builder/eic_builder.def new file mode 100644 index 0000000000000000000000000000000000000000..d2ba0e8847ad30e8c50f244994d98f98eba580cd --- /dev/null +++ b/containers/builder/eic_builder.def @@ -0,0 +1,19 @@ +Bootstrap: docker +From: eicweb.phy.anl.gov:4567/containers/eic_container/eic_builder:latest + +%help + EIC software container. + Tools: + Tools: + - eic_shell : Bash shell in this container + - root : Root shell in the container + - ipython : Python shell in the container + +%labels + Maintainer "Whitney Armstrong, Sylvester Joosten" + Version v2.0 + +%post -c /bin/bash + echo " -------------------------------------------------" + echo " ===> Image setup complete" + echo " -------------------------------------------------" diff --git a/containers/builder/version.sh b/containers/builder/version.sh new file mode 100644 index 0000000000000000000000000000000000000000..279e0acd2a1b6dcd6bd0c7132ec7af650a504541 --- /dev/null +++ b/containers/builder/version.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +head -n1 ../../VERSION diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile deleted file mode 100644 index 69fb13d66579adee1b350dd71f54a290d59ff7e2..0000000000000000000000000000000000000000 --- a/containers/docker/Dockerfile +++ /dev/null @@ -1,134 +0,0 @@ -FROM eicweb.phy.anl.gov:4567/containers/image_recipes/dd4hep_base:latest - -LABEL maintainer="Whitney Armstrong <warmstrong@anl.gov>" \ - name="eic_container" \ - group="containers/eic_container" \ - march="native" \ - basedist="ubuntu" \ - base="dd4hep_base" - -ENV PYTHONPATH="/usr/local/lib:${PYTHONPATH}" -#RUN source /usr/local/bin/thisroot.sh \ - -COPY HepPDT-3.04.01.tar.gz /tmp/HepPDT-3.04.01.tar.gz -RUN cd /tmp \ - && apt-get update && apt-get install -y libtbb-dev libtbb2 \ - && tar -zxf HepPDT-3.04.01.tar.gz \ - && cd HepPDT-3.04.01 \ - && ./configure --prefix=/usr/local && make -j30 && make install \ - && cd /tmp && rm -r HepPDT-3.04.01 - -RUN cd /tmp \ - && git clone https://gitlab.cern.ch/hepmc/HepMC3.git \ - && mkdir HepMC3/build && cd HepMC3/build \ - && cmake ../. -DHEPMC3_ENABLE_ROOTIO=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DHEPMC3_BUILD_EXAMPLES=ON \ - && make -j20 \ - && make install \ - && cd /tmp && rm -rf /tmp/HepMC3 - -RUN cd /tmp \ - && apt-get update && apt-get install -y rsync \ - && wget http://home.thep.lu.se/~torbjorn/pythia8/pythia8244.tgz \ - && tar -zxf pythia8244.tgz && cd pythia8244 \ - && ./configure --prefix=/usr/local --enable-shared --enable-64bit --with-root --with-hepmc3 \ - && make -j30 \ - && make install \ - && cd /tmp && rm -rf /tmp/pythia8244 - -RUN apt-get update && apt-get remove -y libtbb-dev libtbb2 \ - && cd /tmp \ - && git clone https://eicweb.phy.anl.gov/eic_tools/DD4hep.git \ - && source /usr/local/bin/thisroot.sh \ - && source /usr/local/bin/geant4.sh \ - && mkdir -p DD4hep/build && cd DD4hep/build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DCMAKE_CXX_STANDARD=17 \ - -DDD4HEP_USE_GEANT4=ON \ - -DDD4HEP_USE_HEPMC3=ON \ - && make -j30 && make -j4 install \ - && cd /tmp && rm -rf /tmp/DD4hep \ - && apt-get update && apt-get install -y libtbb-dev libtbb2 \ - && apt-get clean -y - - - -RUN cd /tmp \ - && git clone https://github.com/acts-project/acts.git \ - && source /usr/local/bin/thisroot.sh \ - && source /usr/local/bin/geant4.sh \ - && source /usr/local/bin/thisdd4hep.sh \ - && mkdir -p acts/build && cd acts/build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DCMAKE_CXX_STANDARD=17 \ - -DACTS_BUILD_DD4HEP_PLUGIN=ON \ - -DACTS_BUILD_TGEO_PLUGIN=ON \ - -DACTS_BUILD_JSON_PLUGIN=ON \ - -DACTS_BUILD_IDENTIFICATION_PLUGIN=ON \ - -DACTS_BUILD_FATRAS=ON \ - -DACTS_BUILD_DIGITIZATION_PLUGIN=ON \ - && make -j30 && make -j4 install \ - && cd /tmp && rm -rf /tmp/acts - -RUN cd /tmp \ - && source /usr/local/bin/thisroot.sh \ - && source /usr/local/bin/geant4.sh \ - && git clone https://eicweb.phy.anl.gov/EIC/podio.git \ - && mkdir -p podio/build && cd podio/build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \ - && make -j30 && make -j4 install \ - && cd /tmp/podio/lcio2 && mkdir build && cd build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \ - && make -j30 && make -j4 install \ - && cd /tmp/podio/lcio2_tools && mkdir build && cd build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \ - && make -j30 && make -j4 install \ - && cd /tmp && rm -rf /tmp/podio - -RUN cd /tmp \ - && git clone https://eicweb.phy.anl.gov/eic_tools/GenFit.git \ - && mkdir -p /tmp/GenFit/build \ - && cd /tmp/GenFit/build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \ - && make -j4 \ - && make -j4 install \ - && cd /tmp && rm -rf /tmp/GenFit - -RUN cd /tmp && git clone https://eicweb.phy.anl.gov/EIC/GenFind.git \ - && mkdir -p /tmp/GenFind/build \ - && cd /tmp/GenFind/build \ - && cmake ../. -DCMAKE_CXX_STANDARD=17 \ - && make VERBOSE=1 \ - && make -j4 install \ - && cd /tmp && rm -rf /tmp/GenFind - - -RUN cd /tmp \ - && git clone https://eicweb.phy.anl.gov/EIC/NPDet.git \ - && source /usr/local/bin/thisroot.sh \ - && source /usr/local/bin/geant4.sh \ - && source /usr/local/bin/thisdd4hep.sh \ - && mkdir -p NPDet/build && cd NPDet/build \ - && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \ - && make -j30 && make -j4 install \ - && cd /tmp && rm -rf /tmp/NPDet - -RUN cd /tmp \ - && apt-get install -y libtbb-dev \ - && pip3 install six \ - && source /usr/local/bin/thisroot.sh \ - && source /usr/local/bin/geant4.sh \ - && source /usr/local/bin/thisdd4hep.sh \ - && git clone https://eicweb.phy.anl.gov/eic_tools/gaudi.git \ - && mkdir -p gaudi/build && cd gaudi/build \ - && cmake --version \ - && cmake ../. -DBoost_NO_BOOST_CMAKE=TRUE \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DGAUDI_USE_SYSTEM_CPP_GSL=OFF \ - -DGAUDI_USE_SYSTEM_RANGES_V3=OFF \ - -DCMAKE_CXX_STANDARD=17 \ - && make VERBOSE=1 && make -j4 install \ - && cd /tmp && rm -rf /tmp/gaudi - - - - diff --git a/containers/docker/HepPDT-3.04.01.tar.gz b/containers/docker/HepPDT-3.04.01.tar.gz deleted file mode 100644 index f78aef65c48177f4952936dbbb775f73f025d21c..0000000000000000000000000000000000000000 Binary files a/containers/docker/HepPDT-3.04.01.tar.gz and /dev/null differ diff --git a/containers/docker/usage.sh b/containers/docker/usage.sh deleted file mode 100644 index 0b72b4786a77c190f0247a7f566fc50f93c914d6..0000000000000000000000000000000000000000 --- a/containers/docker/usage.sh +++ /dev/null @@ -1,26 +0,0 @@ -# INSTALL -# - copy the files deploy.env, config.env, version.sh and Makefile to your repo -# - replace the vars in deploy.env -# - define the version script - -# Build the container -make build - -# Build and publish the container -make release - -# Publish a container to AWS-ECR. -# This includes the login to the repo -make publish - -# Run the container -make run - -# Build an run the container -make up - -# Stop the running container -make stop - -# Build the container with differnt config and deploy file -make cnf=another_config.env dpl=another_deploy.env build \ No newline at end of file diff --git a/containers/docker/version.sh b/containers/docker/version.sh deleted file mode 100644 index e2121fa8566f693cf71fca7074bb4bc5b9455a67..0000000000000000000000000000000000000000 --- a/containers/docker/version.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -grep "eic_container VERSION" ../../CMakeLists.txt | sed 's/project (eic_container VERSION //' | sed 's/)//' - diff --git a/containers/release/Dockerfile b/containers/release/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ab677c9c14908c2490df2698b0228a94e0fa7319 --- /dev/null +++ b/containers/release/Dockerfile @@ -0,0 +1,34 @@ +# Release container for Argonne EIC software +# Copy over relevant files from builder +# +FROM eicweb.phy.anl.gov:4567/containers/eic_container/eic_builder:latest as builder +RUN cd /opt/spack-environment && spack env activate . && spack gc -y + +FROM eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_minimal:20.04 +LABEL maintainer="Sylvester Joosten <sjoosten@anl.gov>" \ + name="eic_container" \ + group="eic_container" \ + march="native" \ + basedist="ubuntu" \ + base="ubuntu" + +ENV DOCKERFILE_BASE=ubuntu \ + DOCKERFILE_DISTRO=ubuntu \ + DOCKERFILE_DISTRO_VERSION=20.04 \ + DEBIAN_FRONTEND=noninteractive \ + CURRENTLY_BUILDING_DOCKER_IMAGE=1 \ + container=docker + +## Copy over files from builder +COPY --from=builder /opt/spack-environment /opt/spack-environment +COPY --from=builder /opt/software /opt/software +COPY --from=builder /opt/view /opt/view +COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh +## Setup global bashrc, useful for singularity +COPY --from=builder /root/.bashrc /etc/bash.bashrc + +## make sure we have the entrypoints setup correctly +ENTRYPOINT [] +CMD ["bash", "--rcfile", "/etc/profile", "-l"] +USER 0 +WORKDIR / diff --git a/containers/release/Makefile b/containers/release/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e66f3dffb0ee5060610f84bc99a3c51d35f215c8 --- /dev/null +++ b/containers/release/Makefile @@ -0,0 +1,204 @@ +# import config. +# You can change the default config with `make cnf="config_special.env" build` +cnf ?= config.env +include $(cnf) +# exports variables in config.env as environment variables +export $(shell sed 's/=.*//' $(cnf)) + + +# import deploy config +# You can change the default deploy config with `make cnf="deploy_special.env" release` + +SHELL = bash +# grep the version from the mix file +VERSION=$(shell bash version.sh) + + +# help will output the help for each task +# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html +.PHONY: help + +help: ## This help. + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) + +.DEFAULT_GOAL := help + +# ========================================================================== +# +build: ## build the image + docker build -t $(APP_NAME) . + +build-nc: ## Build the container without caching (from scratch) + docker build --no-cache -t $(APP_NAME) . + +build-alt: ## build the container for various machine architectures (broadwell, haswell, knl) + @echo 'building for architecture: $(ALT_NAME)' + docker build -t $(APP_NAME)_$(ALT_NAME) -f Dockerfile.$(ALT_NAME) . + +build-alt-nc: ## build the container for various machine architectures (broadwell, haswell, knl) + @echo 'build-alt-nc: building for architecture: $(ALT_NAME)' + docker build --no-cache -t $(APP_NAME)_$(ALT_NAME) -f Dockerfile.$(ALT_NAME) . + +# ========================================================================== +# +run: ## Run container on port configured in `config.env` + docker run -i -t --rm --env-file=./config.env -p=$(PORT):$(PORT) --name="$(APP_NAME)" $(REPO)/$(APP_NAME):$(TAG_VERSION) + +up: build run ## Run container on port configured in `config.env` (Alias to run) + +stop: ## Stop and remove a running container + docker stop $(APP_NAME); docker rm $(APP_NAME) + +# ========================================================================== +# +tag: tag-latest tag-version #tag-version ## Generate container tags for the `{version}` and `latest` tags + +tag-latest: ## Generate container `{version}` tag + @echo 'create tag latest' + #docker tag $(APP_NAME) $(REPO)/$(APP_NAME):latest + +tag-version: ## Generate container `latest` tag + @echo 'creating tag $(APP_NAME):$(VERSION)' + docker tag $(APP_NAME):latest $(APP_NAME):$(VERSION) + +tag-alt: tag-alt-latest # tag-alt-version ## Generate container tags for the `{version}` ans `latest` tags + +tag-alt-latest: ## Generate container `{version}` tag + @echo 'create tag latest' + #docker tag $(APP_NAME)_$(ALT_NAME) $(REPO)/$(APP_NAME)_$(ALT_NAME):latest + +tag-alt-version: ## Generate container `{version}` tag + @echo 'create tag latest' + docker tag $(APP_NAME)_$(ALT_NAME) $(REG_NAME)/$(REPO)/$(APP_NAME)_$(ALT_NAME):$(VERSION) + +# ========================================================================== +# +login: ## Auto login to AWS-ECR unsing aws-cli + docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} + echo "Login COMPLETE" + +release: build-nc publish ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to ECR + @echo "Cleaning up" + docker rmi $(APP_NAME):latest + +release-cached: build publish ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to ECR + +publish: login publish-latest publish-version #publish-version ## Publish the `{version}` ans `latest` tagged containers to ECR + @echo "Publishing done" + + +publish-latest: ## Publish the `latest` taged container to ECR + @echo 'publish latest to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)' + docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest + #docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest + +publish-version: tag-version ## Publish the `{version}` taged container to ECR + @echo 'publish latest to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)' + docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION) + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION) + #docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION) + +push: login ## push after login @echo 'push latest to $(REG_NAME)/$(REPO)/$(APP_NAME):latest' + docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest + +# ========================================================================== +# +release-alt: build-alt publish-alt ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to ECR + +publish-alt: login publish-alt-latest #publish-alt-version ## Publish the `{version}` ans `latest` tagged containers to ECR + +push-alt: login tag-alt-latest ## push after login + #docker push $(REG_NAME)/$(REPO)/$(APP_NAME)_$(ALT_NAME):latest + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest + +publish-alt-latest: #tag-alt-latest ## Publish the `latest` taged container to ECR + #docker push $(REG_NAME)/$(REPO)/$(APP_NAME)_$(ALT_NAME):latest + docker tag $(APP_NAME)_$(ALT_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest + docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest + +publish-alt-version: tag-alt-version ## Publish the `latest` taged container to ECR + #docker push $(REG_NAME)/$(REPO)/$(APP_NAME)_$(ALT_NAME):$(VERSION) + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):$(VERSION) + +# ========================================================================== +# + +login-dockerhub: ## login to hub.docker.com + @echo 'docker hub login :' + docker login + +push-dockerhub: build #publish-version ## Publish the `{version}` ans `latest` tagged containers to ECR + @echo '$(DH_ORG)/$(APP_NAME):$(TAG_VERSION)' + docker push $(DH_ORG)/$(APP_NAME):latest + #docker push $(DH_ORG)/$(APP_NAME):$(VERSION) + +publish-dockerhub: build tag #publish-version ## Publish the `{version}` ans `latest` tagged containers to ECR + @echo '$(DH_ORG)/$(APP_NAME):$(TAG_VERSION)' + docker push $(DH_ORG)/$(APP_NAME):latest + #docker push $(DH_ORG)/$(APP_NAME):$(VERSION) + +# ========================================================================== +# +clean-tags: + docker rmi $(REPO)/$(APP_NAME):latest || true + docker rmi $(GL_GROUP)/$(APP_NAME):latest || true + docker rmi $(GL_REG_GROUP)/$(APP_NAME):latest || true + docker rmi $(REG_NAME)/$(REPO)/$(APP_NAME):latest || true + docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest || true + docker rmi $(REPO)/$(APP_NAME)_$(ALT_NAME):latest || true + docker rmi $(GL_GROUP)/$(APP_NAME)_$(ALT_NAME):latest || true + docker rmi $(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest || true + docker rmi $(REG_NAME)/$(REPO)/$(APP_NAME)_$(ALT_NAME):latest || true + docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest || true + +clean: + docker rmi $(REPO_NAME)/$(APP_NAME) || true + docker rmi $(REPO_NAME)/$(APP_NAME):$(TAG_VERSION) || true + docker rmi $(REPO_NAME)/$(APP_NAME):$(VERSION) || true + docker rmi $(REPO)/$(APP_NAME) || true + docker rmi $(REPO)/$(APP_NAME):$(TAG_VERSION) || true + docker rmi $(REPO)/$(APP_NAME):$(VERSION) || true + docker rmi $(REG_NAME)/$(REPO)/$(APP_NAME):latest || true + docker rmi $(REG_NAME)/$(REPO)/$(APP_NAME):$(TAG_VERSION) || true + docker rmi $(REG_NAME)/$(REPO)/$(APP_NAME) || true + docker rmi $(DH_ORG)/$(APP_NAME) || true + docker rmi $(DH_ORG)/$(APP_NAME):$(TAG_VERSION) || true + docker rmi $(DH_ORG)/$(APP_NAME):$(VERSION) || true + docker rmi $(GL_REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest || true + docker rmi $(GL_REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION) || true + docker rmi $(GL_REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME) || true + docker rmi $(GL_REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):latest || true + docker rmi $(GL_REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):$(VERSION) || true + docker rmi $(GL_REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME) || true + docker rmi $(GL_REG_GROUP)/$(APP_NAME) || true + docker rmi $(GL_REG_GROUP)/$(APP_NAME):$(VERSION) || true + docker rmi $(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME) || true + docker rmi $(GL_REG_GROUP)/$(APP_NAME)_$(ALT_NAME):$(VERSION) || true + docker rmi $(GL_REG_NAME)/$(REG_USER)/$(APP_NAME) || true + docker rmi $(GL_REG_NAME)/$(REG_USER)/$(APP_NAME):$(VERSION) || true + #docker rmi $(APP_NAME) || true + +version: ## Output the current version + @echo $(VERSION) + +# ========================================================================== +# +info: ## Output the current version + @echo 'VERSION = $(VERSION) ' + @echo 'REG_USER = $(REG_USER) ' + @echo 'REG_NAME = $(REG_NAME) ' + @echo 'ALT_NAME = $(ALT_NAME) ' + @echo 'APP_NAME = $(APP_NAME) ' + @echo 'REPO_NAME = $(REPO_NAME) ' + @echo 'DH_ORG = $(DH_ORG) ' + @echo 'GL_GROUP = $(GL_GROUP) ' + @echo 'GL_REG_GROUP = $(GL_REG_GROUP)' + @echo 'GL_REG_NAME = $(GL_REG_NAME) ' + @echo 'REPO = $(REPO) ' + @echo 'TAG_VERSION = $(TAG_VERSION) ' + +ls: ## list all docker images + docker images diff --git a/containers/release/config.env b/containers/release/config.env new file mode 100644 index 0000000000000000000000000000000000000000..da3c4f905c37876319551989888a6e065a482cd6 --- /dev/null +++ b/containers/release/config.env @@ -0,0 +1,22 @@ +REG_TOKEN ?= ${CI_IMAGE_BUILD_PAT} +REG_USER ?= whit +REG_HOST ?= eicweb.phy.anl.gov +REG_NAME ?= eicweb.phy.anl.gov:4567 +REG_PORT ?= 4567 +REG_URL ?= https://$(REG_HOST) + +# name of alternate build: +# Dockerfile.$(ALT_NAME) --> $(APP_NAME)_${ALT_NAME} +ALT_NAME ?= broadwell + +APP_NAME = eic +REPO_NAME = eic + +DH_ORG = eic + +GL_GROUP = eic_container +GL_REG_GROUP = containers/eic_container +GL_REG_NAME = $(REG_NAME) + +REPO = $(REG_USER) +TAG_VERSION = latest diff --git a/containers/release/eic.def b/containers/release/eic.def new file mode 100644 index 0000000000000000000000000000000000000000..b83c9e4b42e2fba89479ab25260ff40fb18d88b1 --- /dev/null +++ b/containers/release/eic.def @@ -0,0 +1,18 @@ +Bootstrap: docker +From: eicweb.phy.anl.gov:4567/containers/eic_container/eic:latest + +%help + EIC software container. + Tools: + - eic_shell : Bash shell in this container + - root : Root shell in the container + - ipython : Python shell in the container + +%labels + Maintainer "Whitney Armstrong, Sylvester Joosten" + Version v2.0 + +%post -c /bin/bash + echo " -------------------------------------------------" + echo " ===> Image setup complete" + echo " -------------------------------------------------" diff --git a/containers/release/version.sh b/containers/release/version.sh new file mode 100644 index 0000000000000000000000000000000000000000..279e0acd2a1b6dcd6bd0c7132ec7af650a504541 --- /dev/null +++ b/containers/release/version.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +head -n1 ../../VERSION diff --git a/containers/singularity/eic.def b/containers/singularity/eic.def deleted file mode 100644 index b588a2e19b3d8568401a3182431a62d2f59726a2..0000000000000000000000000000000000000000 --- a/containers/singularity/eic.def +++ /dev/null @@ -1,204 +0,0 @@ -Bootstrap: docker -From: eicweb.phy.anl.gov:4567/containers/eic_container/eic_container:latest - -%help - EIC software container. - Tools: - - root : root version used for the analyzer - - rootls, rootbrowse, root-config, hadd, h2root - - dd4hep: ddeve, ddsim - - genfit - -%labels - Maintainer "Whitney Armstrong" - Version v1.0 - -%post -c /bin/bash - echo " Image build is now mostly done in dockerfile" - echo " -------------------------------------------------" - echo " ===> Image setup complete" - echo " -------------------------------------------------" - -# =================================== -# GLOBAL -# =================================== - -%environment -c /bin/bash - export PYTHONPATH=/usr/local/lib:$PYTHONPATH - export PATH=/usr/loca/bin:${PATH} - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - export ROOT_INCLUDE_PATH=/usr/local/include - export EPICS_ROOT=/usr/local/epics - export EPICS_BASE=/usr/local/epics/base - export EPICS_HOST_ARCH=linux-x86_64 - export PATH=$EPICS_ROOT/bin:$PATH - export LD_LIBRARY_PATH=$EPICS_ROOT/lib:$LD_LIBRARY_PATH - export PATH=$EPICS_BASE/bin/$EPICS_HOST_ARCH:$PATH - export LD_LIBRARY_PATH=$EPICS_BASE/lib/$EPICS_HOST_ARCH:$LD_LIBRARY_PATH - -%runscript -c /bin/bash - echo "Launching a shell in the Hall A/C container." - echo "Use through singularity apps recommended (see help for more info)." - exec "$@" - -# =================================== -# ddsim -# =================================== -#%apprun ddsim -# . /usr/local/bin/thisdd4hep.sh -# ddsim "%@" -# -#%appenv ddsim -# export PYTHONPATH=/usr/local/lib:$PYTHONPATH -# export PATH=/usr/loca/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## ddeve -## ======================= -#%apprun ddeve -# . /usr/local/bin/thisdd4hep.sh -# ddeve "$@" -# -#%appenv ddeve -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## root -## ======================= -#%apprun root -# . /usr/local/bin/thisdd4hep.sh -# root "$@" -# -#%appenv root -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# export EPICS_ROOT=/usr/local/epics -# export EPICS_BASE=/usr/local/epics/base -# export EPICS_HOST_ARCH=linux-x86_64 -# export PATH=$EPICS_ROOT/bin:$PATH -# export LD_LIBRARY_PATH=$EPICS_ROOT/lib:$LD_LIBRARY_PATH -# export PATH=$EPICS_BASE/bin/$EPICS_HOST_ARCH:$PATH -# export LD_LIBRARY_PATH=$EPICS_BASE/lib/$EPICS_HOST_ARCH:$LD_LIBRARY_PATH -# -## ======================= -## root-config -## ======================= -#%apprun root-config -# . /usr/local/bin/thisdd4hep.sh -# root-config "$@" -# -#%appenv root-config -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -# -## ======================= -## rootbrowse -## ======================= -#%apprun rootbrowse -# . /usr/local/bin/thisdd4hep.sh -# rootbrowse "$@" -# -#%appenv rootbrowse -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## rootls -## ======================= -#%apprun rootls -# . /usr/local/bin/thisdd4hep.sh -# rootls "$@" -# -#%appenv rootls -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## hadd -## ======================= -#%apprun hadd -# . /usr/local/bin/thisdd4hep.sh -# hadd "$@" -# -#%appenv hadd -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## h2root -## ======================= -#%apprun h2root -# . /usr/local/bin/thisdd4hep.sh -# h2root "$@" -# -#%appenv h2root -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## xml2evio -## ======================= -#%apprun xml2evio -# . /usr/local/bin/thisdd4hep.sh -# xml2evio "$@" -# -#%appenv xml2evio -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## evio2xml -## ======================= -#%apprun evio2xml -# evio2xml "$@" -# -#%appenv evio2xml -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## evioCat -## ======================= -#%apprun evioCat -# . /usr/local/bin/thisdd4hep.sh -# evioCat "$@" -# -#%appenv evioCat -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include -# -## ======================= -## eviocopy -## ======================= -#%apprun eviocopy -# eviocopy "$@" -# -#%appenv eviocopy -# export PYTHONPATH=/usr/local/lib:${PYTHONPATH} -# export PATH=/usr/local/bin:${PATH} -# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -# export ROOT_INCLUDE_PATH=/usr/local/include diff --git a/deploy.py b/deploy.py index 0ed31815461b963059e1248919f463944352f26a..43b998050fa23bee1b485d7f1e812541191b49de 100755 --- a/deploy.py +++ b/deploy.py @@ -22,42 +22,16 @@ from install.util import smart_mkdir, project_version, InvalidArgumentError ## Gitlab group and project/program name. GROUP_NAME='containers' PROJECT_NAME='eic_container' -PROGRAMS = [('container_dev', '/usr/bin/bash'), - 'ddsim', - 'geoConverter', - 'materialScan', - 'geoDisplay', - 'geoPluginRun', - 'teveDisplay', - 'ddeve', - 'g4FromXML' - 'geoDisplay', - 'listcomponents', - 'print_materials', - 'dumpBfield', - 'g4gdmlDisplay', - 'geoPluginRun', - 'materialBudget', - 'pyddg4', - 'dumpdetector', - 'graphicalScan', - 'root', - 'root-config', - 'rootbrowse', - 'rootls', - 'mongo', - 'mongod', - 'mongodump', - 'mongoexport', - 'mongoimport', - 'mongostat'] +IMAGE_ROOT='eic' + +PROGRAMS = [('eic_shell', '/usr/bin/bash'), + 'root', + 'ipython'] ## URL for the current container (git tag will be filled in by the script) -CONTAINER_URL = r'https://eicweb.phy.anl.gov/{group}/{project}/-/jobs/artifacts/{version}/raw/build/eic.sif?job=eic_singularity' +CONTAINER_URL = r'https://eicweb.phy.anl.gov/{group}/{project}/-/jobs/artifacts/{version}/raw/build/{img}.sif?job={img}_singularity' -CONTAINER_ENV=r'''source /usr/local/bin/thisdd4hep.sh -ROOT_INCLUDE_PATH=/usr/local/include:/usr/include/eigen3:$ROOT_INCLUDE_PATH -''' +CONTAINER_ENV=r'''source /etc/profile''' ## Singularity bind directive BIND_DIRECTIVE= '-B {0}:{0}' @@ -86,6 +60,10 @@ if __name__ == "__main__": '-m', '--module-path', dest='module_path', help='(opt.) Root module path where you want to install a modulefile. D: <prefix>/../../etc/modulefiles') + parser.add_argument( + '--install-builder', + dest='builder', + help='(opt.) Install fat builder image, instead of normal slim image') args = parser.parse_args() @@ -114,14 +92,14 @@ if __name__ == "__main__": ## Create our install prefix if needed and ensure it is writable args.prefix = os.path.abspath(args.prefix) if not args.module_path: - args.module_path = '{}/etc/modulefiles'.format(args.prefix) + args.module_path = os.path.abspath('{}/../../etc/modulefiles'.format(args.prefix)) print('Install prefix:', args.prefix) print('Creating install prefix if needed...') bindir = '{}/bin'.format(args.prefix) libdir = '{}/lib'.format(args.prefix) libexecdir = '{}/libexec'.format(args.prefix) root_prefix = os.path.abspath('{}/..'.format(args.prefix)) - moduledir = '{}/etc/modulefiles/{}'.format(root_prefix, PROJECT_NAME) + moduledir = '{}/{}'.format(args.module_path, PROJECT_NAME) for dir in [bindir, libdir, libexecdir, moduledir]: print(' -', dir) smart_mkdir(dir) @@ -131,9 +109,13 @@ if __name__ == "__main__": ## Get the container ## We want to slightly modify our version specifier: if it leads with a 'v' drop the v - container = '{}/{}.sif.{}'.format(libdir, PROJECT_NAME, version) + img = IMAGE_ROOT + if args.builder: + img += "_builder" + container = '{}/{}.sif.{}'.format(libdir, img, version) if not os.path.exists(container) or args.force: - url = CONTAINER_URL.format(group=GROUP_NAME, project=PROJECT_NAME, version=vversion) + url = CONTAINER_URL.format(group=GROUP_NAME, project=PROJECT_NAME, + version=vversion, img=img) print('Downloading container from:', url) print('Destination:', container) urllib.request.urlretrieve(url, container) diff --git a/install/launcher.py b/install/launcher.py index 6ab5f09030fa298439bb934ae939cf3592f51e23..00742a6262502cdb365bafd912dbc8604358a1e8 100644 --- a/install/launcher.py +++ b/install/launcher.py @@ -94,7 +94,7 @@ def make_launcher(app, container, bindir, libexecdir = bindir ## actual exe we want to run, default: same as app - exe=app + exe=exe ## paths launcher_path = '{}/{}'.format(bindir, app) diff --git a/modulefiles/CMakeLists.txt b/modulefiles/CMakeLists.txt deleted file mode 100644 index 3a434e8b6956332139e893a2ff3f687a6dcebd02..0000000000000000000000000000000000000000 --- a/modulefiles/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -################################################################################ -## Configure modulefile for our environment -################################################################################ -set(MODULEFILE "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") -configure_file(modulefile.in ${MODULEFILE} @ONLY) - -################################################################################ -## Install the modulefile to <install_module_dir>/<project>/<version> -################################################################################ -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULEFILE} - DESTINATION "${INSTALL_MODULE_DIR}/${PROJECT_NAME}" COMPONENT lib) diff --git a/modulefiles/modulefile.in b/modulefiles/modulefile.in deleted file mode 100644 index 46151bdc040edc76f9edcaee673f0694a72dc720..0000000000000000000000000000000000000000 --- a/modulefiles/modulefile.in +++ /dev/null @@ -1,14 +0,0 @@ -#%Module1.0##################################################################### -## -## for tmux -## -proc ModulesHelp { } { - puts stderr "This module sets up the environment for the EIC container" -} -module-whatis "@PROJECT_NAME@ @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@" - -# for Tcl script use only -set version 4.1.4 -set iprefix @CMAKE_INSTALL_PREFIX@ - -prepend-path PATH $iprefix/bin diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt deleted file mode 100644 index ea755874f13c89de21a5c4f6ee5b45546320d662..0000000000000000000000000000000000000000 --- a/scripts/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -################################################################################ -## Configure launcher scripts for our singularity apps -################################################################################ - -set(APPS - "ddsim" - "geoConverter" - "materialScan" - "geoDisplay" - "geoPluginRun" - "teveDisplay" - "ddeve" - "g4FromXML" - "geoDisplay" - "listcomponents" - "print_materials" - "dumpBfield" - "g4gdmlDisplay" - "geoPluginRun" - "materialBudget" - "pyddg4" - "dumpdetector" - "graphicalScan" - "root" - "root-config" - "rootbrowse" - "rootls" - "mongo" - "mongod" - "mongodump" - "mongoexport" - "mongoimport" - "mongostat" - ) - -set(APPS_ABSOLUTE_PATH "") - -## Bind directive for known systems -set (OPT_BIND_DIRECTIVE "") -foreach(BIND_PATH ${INSTALL_BIND_PATH}) - if (NOT "${BIND_PATH} " EQUAL " " AND EXISTS ${BIND_PATH}) - set (OPT_BIND_DIRECTIVE "${OPT_BIND_DIRECTIVE} -B ${BIND_PATH}:${BIND_PATH} ") - endif () -endforeach() -message("Adding singularity bind directive: '${OPT_BIND_DIRECTIVE}'") - -find_program(SINGULARITY singularity) - -foreach(APP ${APPS}) - configure_file(launcher.in ${APP} @ONLY) - configure_file(wrapper.in ${APP}_wrap @ONLY) - set(APPS_ABSOLUTE_PATH ${APPS_ABSOLUTE_PATH} "${CMAKE_CURRENT_BINARY_DIR}/${APP}") - set(APPS_ABSOLUTE_PATH ${APPS_ABSOLUTE_PATH} "${CMAKE_CURRENT_BINARY_DIR}/${APP}_wrap") -endforeach () - -configure_file(container_dev.in container_dev @ONLY) -configure_file(container_shell_wrap.in container_shell_wrap @ONLY) -set(APPS_ABSOLUTE_PATH ${APPS_ABSOLUTE_PATH} "${CMAKE_CURRENT_BINARY_DIR}/container_dev") -set(APPS_ABSOLUTE_PATH ${APPS_ABSOLUTE_PATH} "${CMAKE_CURRENT_BINARY_DIR}/container_shell_wrap") - -################################################################################ -## Install the launcher scripts to <prefix>/bin -################################################################################ -install(PROGRAMS ${APPS_ABSOLUTE_PATH} - DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin) - - diff --git a/scripts/container_dev.in b/scripts/container_dev.in deleted file mode 100644 index 661650314d7caf95445ee0ec7d906e62a008c596..0000000000000000000000000000000000000000 --- a/scripts/container_dev.in +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -piped_args= -if [ -p /dev/stdin ]; then - # If we want to read the input line by line - while IFS= read line; do - #echo "Line: ${line}" - if [ -z "$piped_args" ]; then - piped_args="${line}" - else - piped_args="${piped_args}\n${line}" - fi - done -fi - -if [ ${piped_args} ] ; then -echo -e ${piped_args} | @SINGULARITY@ exec @OPT_BIND_DIRECTIVE@@INSTALL_LIB_DIR@/@CONTAINER@ @INSTALL_BIN_DIR@/container_shell_wrap $@ -else -@SINGULARITY@ exec @OPT_BIND_DIRECTIVE@@INSTALL_LIB_DIR@/@CONTAINER@ @INSTALL_BIN_DIR@/container_shell_wrap $@ -fi diff --git a/scripts/container_shell_wrap.in b/scripts/container_shell_wrap.in deleted file mode 100644 index d2238ea987b47b56eae8a14b5dc371fe03769fd9..0000000000000000000000000000000000000000 --- a/scripts/container_shell_wrap.in +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -source /usr/local/bin/thisdd4hep.sh -ROOT_INCLUDE_PATH=/usr/local/include:/usr/include/eigen3:$ROOT_INCLUDE_PATH -piped_args= -if [ -p /dev/stdin ]; then - # If we want to read the input line by line - while IFS= read line; do - #echo "Line: ${line}" - if [ -z "$piped_args" ]; then - piped_args="${line}" - else - piped_args="${piped_args}\n${line}" - fi - done -fi - -if [ ${piped_args} ] ; then -echo -e ${piped_args} | /usr/bin/bash $@ -else -/usr/bin/bash $@ -fi diff --git a/scripts/launcher.in b/scripts/launcher.in deleted file mode 100644 index e570c6ad98f6d6cd52179391b419e19ce4a9adef..0000000000000000000000000000000000000000 --- a/scripts/launcher.in +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -piped_args= -if [ -p /dev/stdin ]; then - # If we want to read the input line by line - while IFS= read line; do - #echo "Line: ${line}" - if [ -z "$piped_args" ]; then - piped_args="${line}" - else - piped_args="${piped_args}\n${line}" - fi - done -fi - -if [ ${piped_args} ] ; then -echo -e ${piped_args} | @SINGULARITY@ exec @OPT_BIND_DIRECTIVE@@INSTALL_LIB_DIR@/@CONTAINER@ @INSTALL_BIN_DIR@/@APP@_wrap $@ -else -@SINGULARITY@ exec @OPT_BIND_DIRECTIVE@@INSTALL_LIB_DIR@/@CONTAINER@ @INSTALL_BIN_DIR@/@APP@_wrap $@ -fi diff --git a/scripts/wrapper.in b/scripts/wrapper.in deleted file mode 100644 index 08466e02cef684bb5246b31db981a62a02002d39..0000000000000000000000000000000000000000 --- a/scripts/wrapper.in +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -source /usr/local/bin/thisdd4hep.sh -ROOT_INCLUDE_PATH=/usr/local/include:/usr/include/eigen3:$ROOT_INCLUDE_PATH -piped_args= -if [ -p /dev/stdin ]; then - # If we want to read the input line by line - while IFS= read line; do - #echo "Line: ${line}" - if [ -z "$piped_args" ]; then - piped_args="${line}" - else - piped_args="${piped_args}\n${line}" - fi - done -fi - -if [ ${piped_args} ] ; then -echo -e ${piped_args} | @APP@ $@ -else -@APP@ $@ -fi