Update .gitlab-ci.yml

This commit is contained in:
Solomon Laing 2021-06-13 08:24:15 +00:00
parent 681838a33e
commit 2c597c2ff4

View File

@ -47,7 +47,7 @@ deploy:
- docker - docker
environment: environment:
name: Production name: Production
url: "$Live_Server_IP" url: "$LIVE_SERVER_FQDN"
when: manual when: manual
before_script: before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y)' - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y)'
@ -57,4 +57,4 @@ deploy:
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config' - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
script: script:
- ssh -J "$Live_Server_User"@"$Live_Server_IP" "$Live_Server_User"@"$Live_Server_Target" "echo -e 'dev:\n image: \'$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA\'\n restart: always\n ports:\n - \'8090:5000\'\n only:\n - master' > docker-compose.yml && docker-compose up -d --remove-orphans --force-recreate" - ssh -J "$PROD_SERVER_USER"@"$LIVE_SERVER_FQDN" "$PROD_SERVER_USER"@"$PROD_SERVER_LOCAL_HOST_NAME" "sed 's/"$CI_REGISTRY_IMAGE".*/"$CI_REGISTRY_IMAGE":"$CI_COMMIT_SHA"' && docker-compose up -d --remove-orphans --force-recreate"