forked from SoftwareMaestro11-TEAM-0525/Spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.gitlab-ci.yml
36 lines (32 loc) · 1.02 KB
/
test.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
stages:
- build
- deploy
build:
only:
- develop
- cicd
- ui
stage: build
image: docker:latest
before_script:
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- chmod 400 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh -i ~/.ssh/id_rsa ubuntu@$DEPLOY_SERVER "cd ~/0525 && git checkout origin/develop && git fetch && git pull origin develop && cd frontend && npm install && npm run build"
deploy:
only:
- develop
- cicd
stage: deploy
image: docker:latest
before_script:
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- chmod 400 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh -i ~/.ssh/id_rsa ubuntu@$DEPLOY_SERVER "docker stop nodejs && docker rm nodejs && docker rmi 0525_nodejs && ls && cd 0525 && docker-compose up -d --build"