Functions.deploy.sh 825 Bytes
Newer Older
据说甜蜜呢 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/bash

set -e

# Import external functions
chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh

function CI()
{
    declare serviceName=$1
    declare publishFile=$2
	declare publishOutputDir="/tmp/${serviceName}"

	GetVersion version
	GetImageUserName registryUserName

	# repository name must be lowercase
	ToLower "${RegistryHost}/${registryUserName}/${serviceName}:${version}" imagefullname
	
	echo ""
	echo "Begin delivering for ${serviceName}..."
	echo "Tips: Image full name: ${imagefullname}"
	mkdir -p ${publishOutputDir}
	dotnet publish ${publishFile} -o ${publishOutputDir} -c release --no-restore  
	docker build -t ${imagefullname} ${publishOutputDir}
	docker push ${imagefullname}
	rm -fr ${publishOutputDir}
	echo "Delivery for ${serviceName} has been successful."
}