-
Notifications
You must be signed in to change notification settings - Fork 12
/
.gitlab-ci.yml
49 lines (38 loc) · 1.33 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
variables:
IMAGE_NAME: jainsiddharth1999/zeltatech
IMAGE_TAG: $CI_PROJECT_ID
CONTAINER_NAME_FRONT: $CI_PROJECT_NAME-FRONT
CONTAINER_NAME_BACK: $CI_PROJECT_NAME-BACK
stages:
- deploy_backtest
- deploy_frontest
deploy_back:
only:
changes:
- back_test.py
stage: deploy_backtest
before_script:
- chmod 400 $SSH_PRIVATE_KEY
script:
- ssh -o StrictHostKeyChecking=no -i $SSH_PRIVATE_KEY $SERVER
- docker rmi $IMAGE_NAME:$IMAGE_TAG || true
- docker build -t $IMAGE_NAME:$IMAGE_TAG -f Dockerfile.back_test .
- docker login -u $REGISTRY_USER -p $REGISTRY_PASS &&
- docker stop $CONTAINER_NAME_BACK || true &&
- docker rm $CONTAINER_NAME_BACK || true &&
- docker run -dit --name $CONTAINER_NAME_BACK $IMAGE_NAME:$IMAGE_TAG
deploy_front:
only:
changes:
- front_test.py
stage: deploy_frontest
before_script:
- chmod 400 $SSH_PRIVATE_KEY
script:
- ssh -o StrictHostKeyChecking=no -i $SSH_PRIVATE_KEY $SERVER
- docker rmi $IMAGE_NAME:$IMAGE_TAG || true
- docker build -t $IMAGE_NAME:$IMAGE_TAG -f Dockerfile.front_test .
- docker login -u $REGISTRY_USER -p $REGISTRY_PASS &&
- docker stop $CONTAINER_NAME_FRONT || true &&
- docker rm $CONTAINER_NAME_FRONT || true &&
- docker run -dit --name $CONTAINER_NAME_FRONT $IMAGE_NAME:$IMAGE_TAG