Last active
January 11, 2019 20:20
-
-
Save krohne/c46042766cad635c2e26cfe8fb28962b to your computer and use it in GitHub Desktop.
Copy source file to remote platform docker container. If running from the repository path, container is optional
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
#!/bin/bash | |
# Your bastion username should be in ~/.ssh/config | |
# platform path [container] | |
# preprod /routes/genesys/router.js tripnotificationagent | |
export platform=$1 | |
export repo=$(basename "$PWD") | |
export filename=$2 | |
export container=$3 | |
if [ -z ${container} ]; then export container=$(grep '"name":\s*"\w*",' $PWD/package.json | awk -F '"' '{ print $4 }'); fi | |
export service="rmpay_${container}_1" | |
export directory=$(dirname $filename) | |
ssh $platform mkdir -p staged/$repo/$directory | |
scp -r $PWD/$filename $platform:~/staged/$repo/$filename | |
ssh $platform /bin/bash << EOF | |
docker exec $service mkdir -p /usr/src/app/$directory | |
docker cp ~/staged/$repo/$filename $service:/usr/src/app/$filename | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment