Last active
May 17, 2017 08:32
-
-
Save stampycode/fc031396ebd5b55df74b43585b4a9b1a to your computer and use it in GitHub Desktop.
how to BASH SSH and SUDO
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
ssh ${SERVER} <<ENDSSH | |
cd ${REPO} | |
sudo -s -- <<SUDO | |
unset HISTFILE | |
[[ ! -d /root/.docker ]] && mkdir /root/.docker | |
[[ ! -e /root/.docker/config.json ]] && echo '{"credsStore": "registrycreds"}' > /root/.docker/config.json | |
[[ ! -d /root/bin ]] && mkdir /root/bin | |
echo > /root/bin/docker-credential-registrycreds <<<RRR | |
#!/bin/bash | |
cat <<JSON | |
{ | |
"ServerURL": "${REGISTRYSERVER}", | |
"Username": "${DOCKER_USER}", | |
"Secret": "${DOCKER_PASS}" | |
} | |
JSON | |
RRR | |
chmod u+x /root/bin/docker-credential-registrycreds | |
export PATH=$PATH:/root/bin | |
export DOCKER_USER="${DOCKERUSER}" | |
export DOCKER_PASS="${DOCKERPASS}" | |
docker pull ${REGISTRYSERVER}/${REPO}:${VER} | |
docker-compose up --build -d ${REPO} | |
SUDO | |
ENDSSH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment