global build functions
This commit is contained in:
parent
f09865d3a3
commit
b82666e434
@ -3,7 +3,7 @@
|
||||
# --- Settings
|
||||
RegistryService=cloud21.cvtt.vpn:5500
|
||||
ImageName=md_recorder
|
||||
BashFunctionCode=$(realpath $(dirname ${0}))/../../mu_svc_functions.sh
|
||||
BashFunctionCode=$(realpath $(dirname ${0}))/../../dckr_bld_functions.sh
|
||||
# --- Settings
|
||||
|
||||
usage() {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
# --- Settings
|
||||
RegistryService=cloud21.cvtt.vpn:5500
|
||||
ValidImages=(md_gateway oe_gateway ac_gateway pricer coordinator)
|
||||
BashFunctionCode=$(realpath $(dirname ${0}))/../dckr_bld_functions.sh
|
||||
# --- Settings
|
||||
|
||||
usage() {
|
||||
@ -76,7 +77,7 @@ build_musvc_image() {
|
||||
}
|
||||
|
||||
|
||||
source $(realpath $(dirname ${0}))/mu_svc_functions.sh # ASSUMED same directory
|
||||
source ${BashFunctionCode}
|
||||
if [ "${ImageName}" == "__ALL__" ]; then
|
||||
Images=(${ValidImages[@]})
|
||||
else
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_project_version() {
|
||||
Project=${1}
|
||||
Version=${2}
|
||||
|
||||
host="cloud21.cvtt.vpn"
|
||||
port="22"
|
||||
user="cvttdist"
|
||||
rel_dir="/home/cvttdist/software/cvtt2"
|
||||
|
||||
if [ "${Version}" == "latest" ]; then
|
||||
echo "Checking for latest version of ${Project} on ${user}@${host}:${rel_dir}"
|
||||
Version=$(ssh -q -p ${port} ${user}@${host} "ls -tr ${rel_dir}/${Project} | tail -1" )
|
||||
echo "Latest version is ${Version}"
|
||||
fi
|
||||
echo "Checking ${user}@${host} for ${rel_dir}/${Project}/${Version} ..."
|
||||
if ssh -q -p ${port} ${user}@${host} "test -d ${rel_dir}/${Project}/${Version}"
|
||||
then
|
||||
echo "Getting Version \"${Version}\"..."
|
||||
rsync_cmd="rsync -ahv -e \"ssh -p ${port}\""
|
||||
rsync_cmd="${rsync_cmd} ${user}@${host}:${rel_dir}/${Project}/${Version}/"
|
||||
rsync_cmd="${rsync_cmd} ./"
|
||||
echo ${rsync_cmd}
|
||||
eval ${rsync_cmd}
|
||||
status=$?
|
||||
if [ ${status} -eq 0 ]
|
||||
then
|
||||
echo "Loading successful..."
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "Not Found ${rel_dir}/${Project}/${Version} on ${user}@${host}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
build_docker_image() {
|
||||
ImageName=${1}
|
||||
RegistryService=${2}
|
||||
Version=${3}
|
||||
Project=${4}
|
||||
ProjectVersion=${5}
|
||||
|
||||
Cmd="docker build"
|
||||
if [ "${ProjectVersion}" != "" ]; then
|
||||
Cmd+=" --label ${Project}=\"${ProjectVersion}\""
|
||||
fi
|
||||
Cmd+=" -t ${ImageName}"
|
||||
Cmd+=" -t ${ImageName}:latest"
|
||||
Cmd+=" -t ${ImageName}:${Version}"
|
||||
Cmd+=" -f Dockerfile"
|
||||
Cmd+=" ."
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker tag ${ImageName}:latest ${RegistryService}/${ImageName}:latest"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker tag ${ImageName}:${Version} ${RegistryService}/${ImageName}:${Version}"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker push ${RegistryService}/${ImageName}:latest"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker push ${RegistryService}/${ImageName}:${Version}"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user