-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
34 lines (31 loc) · 1.1 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
stages:
- test
- delivery
- deploy
test-job:
stage: test
script:
- docker-compose -f docker/test/docker-compose.yml down
- docker-compose -f docker/test/docker-compose.yml build api
- docker-compose -f docker/test/docker-compose.yml up --abort-on-container-exit
delivery-job:
stage: delivery
only:
- main
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker tag itsoda14/cityheroes:latest $CI_REGISTRY_IMAGE
- docker push $CI_REGISTRY_IMAGE
deploy-job:
stage: deploy
only:
- main
when: manual
script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=~/.ssh/known_hosts"
- ssh-keyscan 77.223.99.93 >> ~/.ssh/known_hosts
- ssh -i ~/.ssh/id_rsa root@77.223.99.93 'cd cityheroes && git pull https://oauth2:glpat-XT2VRCXwpjuvere4-rMW@gitlab.com/devhell1/cityheroes.git main'
- ssh -i ~/.ssh/id_rsa root@77.223.99.93 'cd cityheroes && docker-compose down && docker-compose up -d --build'