Created
June 24, 2019 17:15
-
-
Save sixeyed/87e72b57b9cdd0979853883ad752dc88 to your computer and use it in GitHub Desktop.
Jenkins snippet for remote building on a Docker Swarm node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build_and_push() { | |
ip=$1 | |
os=$2 | |
arch=$3 | |
docker \ | |
--host tcp://$ip:2376 --tlsverify --tlscacert $ca --tlscert $cert --tlskey $key \ | |
image build --pull -t org/repo:$os-$arch . | |
docker \ | |
--host tcp://$ip:2376 --tlsverify --tlscacert $ca --tlscert $cert --tlskey $key \ | |
login -u $hub_user -p $hub_password | |
docker \ | |
--host tcp://$ip:2376 --tlsverify --tlscacert $ca --tlscert $cert --tlskey $key \ | |
image push org/repo:$os-$arch | |
} | |
cd ./windows | |
winIp=$(nslookup windows.amd64.workers.swarm.sixeyed | tail -n1 | grep Address | awk '{printf ($3" ")}' | tr -d ' ') | |
build_and_push $winIp 'windows' 'amd64' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment