-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
58 lines (51 loc) · 1.54 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
default:
tags:
- apap
workflow:
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == 'main'
before_script:
- docker info
- javac -version
variables:
IMAGE_OPENJDK_GRADLE: gradle:7 .3.3-jdk17-alpine
IMAGE_DOCKER_DIND: docker:20.10.16
stages:
- build-user
- build-image-user
- publish-image-user
- copy-env-user
- build-order
- build-image-order
- publish-image-order
- copy-env-order
- build-catalogue
- build-image-catalogue
- publish-image-catalogue
- copy-env-catalogue
- build-frontend
- build-image-frontend
- publish-image-frontend
- copy-env-frontend
- deploy
include:
- local: 'ci/.deploy-user.yml'
- local: 'ci/.deploy-order.yml'
- local: 'ci/.deploy-catalogue.yml'
- local: 'ci/.deploy-frontend.yml'
deploy:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$DEPLOY_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- echo "Deploy to server..."
- ssh "${DEPLOY_USERNAME}@${DEPLOY_SERVER}" "mkdir -p ~/tk-apap-36/"
- rsync -rahv $CI_PROJECT_DIR/docker-compose-deploy.yml "${DEPLOY_USERNAME}@${DEPLOY_SERVER}:~/tk-apap-36/"
- ssh "${DEPLOY_USERNAME}@${DEPLOY_SERVER}" "cd ~/tk-apap-36/ && docker-compose -f docker-compose-deploy.yml down && docker-compose -f docker-compose-deploy.yml pull && docker-compose -f docker-compose-deploy.yml up -d"