-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
23 lines (22 loc) · 932 Bytes
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
stages:
- deploy
deploy_staging:
stage: deploy
image: kroniak/ssh-client:3.6
script:
- 'which ssh-agent || ( apk add openssh-client -y )'
# add the server as a known host
- mkdir ~/.ssh
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# stop container, remove image.
- ssh -p 2342 [email protected] "cd /home/html/howto.c3roc.de && git pull chaos master"
- ssh -p 2342 [email protected] "docker-compose -f /home/html/howto.c3roc.de/docker-compose.yml stop"
# start new container
- ssh -p 2342 [email protected] "docker-compose -f /home/html/howto.c3roc.de/docker-compose.yml up -d"
only:
- branches