-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
39 lines (36 loc) · 1.6 KB
/
.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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "push"
when: never
stages:
- build
- deploy
docker_build:
image: docker:latest
services:
- docker:dind
stage: build
before_script:
- docker login -u $DO_REGISTRY_USER -p $DO_REGISTRY_PASSWORD registry.digitalocean.com
script:
- docker build -f openapi-test/Dockerfile -t registry.digitalocean.com/walletregistry/openapi:latest openapi-test/
- docker push registry.digitalocean.com/walletregistry/openapi:latest
- docker build -f quivr_project/frontend/Dockerfile -t registry.digitalocean.com/walletregistry/frontend:latest quivr_project/frontend/
- docker push registry.digitalocean.com/walletregistry/frontend:latest
- docker build -f quivr_project/backend/Dockerfile -t registry.digitalocean.com/walletregistry/backend:latest quivr_project/backend/
- docker push registry.digitalocean.com/walletregistry/backend:latest
docker_deploy:
stage: deploy
image: gitlab/dind:latest
services:
- docker:dind
before_script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIV_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- ssh-keyscan -H $DEV_SERVER_IP >> ~/.ssh/known_hosts
script:
- ssh root@$DEV_SERVER_IP "docker login -u $DO_REGISTRY_USER -p $DO_REGISTRY_PASSWORD registry.digitalocean.com; docker pull registry.digitalocean.com/walletregistry/openapi:latest; docker pull registry.digitalocean.com/walletregistry/frontend:latest; docker pull registry.digitalocean.com/walletregistry/backend:latest; cd hongyu/ExpertGPT; docker-compose up -d"