Commit 7149c3c8 authored by Marian Heil's avatar Marian Heil

Generate generic docker image

parent f3626b4d
FROM TEMPLATE_BASE AS base
LABEL name "TEMPLATE_NAME"
ENV TEMPLATE_PREFIX TEMPLATE_FOLDER
# get dependenties
#DEPENDENCIES
# Build docker
FROM base AS builder
COPY install /usr/tmp/
WORKDIR /usr/tmp/TEMPLATE_NAME
RUN ln -s $(which cmake) /usr/bin/cmake3
RUN HEPSW_HOME=TEMPLATE_HEPSW_HOME ./TEMPLATE_NAME-Installer.sh
FROM base
COPY --from=builder $TEMPLATE_PREFIX $TEMPLATE_PREFIX
Subproject commit 7b13cb0d0ac423fd36975b139bc4e6d209ce8f90
Subproject commit 3824346680bab8e5e1175a250977fa20bc88532d
#! /usr/bin/env bash
export HEPSW_HOME="/cvmfs/pheno.egi.eu/HEJ"
MODULE=HEPMC2
image_name(){
# created docker image name
echo "maheil/"${1,,}":latest"
}
# setting up variables
source install/config
declare -n MODULE_DEPENDENCIES=HEPSW_${MODULE}_DEPENDENCIES
declare -n MODULE_VERSION=HEPSW_${MODULE}_VERSION
declare -n MODULE_NAME=HEPSW_${MODULE}_NAME
declare -n MODULE_DIR=HEPSW_${MODULE}_DIR
MODULE_IMAGE=$(image_name ${MODULE_NAME})
MODULE_DOCKER=Docker_${MODULE_NAME}
MODULE_PREFIX=${MODULE}_PREFIX
echo "- Setting up \"${MODULE_DOCKER}\" for \"${MODULE_NAME}\""
mkdir -p build
cd build
cp ../Docker_generic ${MODULE_DOCKER}
sed -i -e "s TEMPLATE_PREFIX ${MODULE_PREFIX} g" ${MODULE_DOCKER} | exit 1
sed -i -e "s TEMPLATE_FOLDER ${MODULE_DIR} g" ${MODULE_DOCKER} | exit 1
sed -i -e "s TEMPLATE_NAME ${MODULE_NAME} g" ${MODULE_DOCKER} | exit 1
sed -i -e "s TEMPLATE_HEPSW_HOME ${HEPSW_HOME} g" ${MODULE_DOCKER} | exit 1
echo "- Installation directory is set to ${HEPSW_HOME}"
if [[ ${#MODULE_DEPENDENCIES[@]} -gt 0 ]]; then
declare -n dep_name=HEPSW_${MODULE_DEPENDENCIES[0]}_NAME
base_docker=$(image_name ${dep_name})
else
base_docker=$(image_name "compiler")
fi
echo "- Using \"${base_docker}\" as base docker"
sed -i -e "s TEMPLATE_BASE ${base_docker} g" ${MODULE_DOCKER} | exit 1
for dep in ${MODULE_DEPENDENCIES[@]:1}; do
declare -n dep_dir=HEPSW_${dep}_DIR
declare -n dep_name=HEPSW_${dep}_NAME
dep_docker=$(image_name ${dep_name})
echo "- Adding additional dependency \"${dep_docker}\""
sed -i -e "s#DEPENDENCIES#DEPENDENCIES\nCOPY --from=${dep_docker} ${dep_dir} ${dep_dir}#g" ${MODULE_DOCKER} | exit 1
done
echo "- Success! To build the docker run:
docker build -t ${MODULE_IMAGE} -f build/${MODULE_DOCKER} ."
exit 0
Markdown is supported
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