Fakultas Ilmu Komputer UI

.gitlab-ci.yml 842 Bytes
Newer Older
Naufaldi Athallah Rifqi's avatar
Naufaldi Athallah Rifqi committed
1
2
image: node:latest

Naufaldi Athallah Rifqi's avatar
Naufaldi Athallah Rifqi committed
3
4
5
deploy-staging:
    stage: deploy
    only:
Naufaldi Athallah Rifqi's avatar
Naufaldi Athallah Rifqi committed
6
      - staging
Naufaldi Athallah Rifqi's avatar
Naufaldi Athallah Rifqi committed
7
8
9
10
11
12
13
14
15
    before_script:
      - apt-get update -qq
      - apt-get install -qq git
      - 'which ssh-agent || ( apt-get install -qq openssh-client )'
      - eval $(ssh-agent -s)
      - ssh-add <(echo "$SSH_PRIVATE_KEY")
      - mkdir -p ~/.ssh
      - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    script:
Naufaldi Athallah Rifqi's avatar
fix ci    
Naufaldi Athallah Rifqi committed
16
      - ssh $SSH_USER@$SSH_IP "cd jitsi-no-jutsu-backend && git pull origin main"
Naufaldi Athallah Rifqi's avatar
fix ci    
Naufaldi Athallah Rifqi committed
17
18
19
      - ssh -i $SSH_PRIVATE_KEY $SSH_USER@$SSH_IP_PROD "docker stop jitsi-no-jutsu-backend || true && docker rm jitsi-no-jutsu-backend"
      - ssh -i $SSH_PRIVATE_KEY $SSH_USER@$SSH_IP_PROD "docker build -t jitsi-no-jutsu-backend ."
      - ssh -i $SSH_PRIVATE_KEY $SSH_USER@$SSH_IP_PROD "docker run -d jitsi-no-jutsu-backend"