-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
38 lines (37 loc) · 1.11 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
image: docker:git
services:
- docker:dind
stages:
- test
- build
- deploy
test:
stage: test
script:
- cd Excel-Events-Backend
- docker build -t tests -f Tests.Dockerfile .
- docker run tests
tags:
- docker
build:
stage: build
script:
- docker login -u excelmec -p $DOCKER_HUB_PASSWORD
- cd Excel-Events-Backend
- docker build -t $DOCKER_IMAGE_NAME:staging -f Production.Dockerfile .
- docker push $DOCKER_IMAGE_NAME:staging
tags:
- docker
only:
- master@excel-mec/excel-events/excel-events-service
deploy:
stage: deploy
script:
- apk add --no-cache rsync openssh
- mkdir -p ~/.ssh
- echo "$DEVELOPMENT_SERVER_PRIVATE_KEY" >> ~/.ssh/id_dsa
- chmod 600 ~/.ssh/id_dsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh $DEVELOPMENT_SERVER_USERNAME@$DEVELOPMENT_SERVER_IP 'cd /home/excel/Excel-Events-Service; docker-compose -f staging.docker-compose.yml down; docker-compose -f staging.docker-compose.yml pull; docker-compose -f staging.docker-compose.yml up -d'
only:
- master@excel-mec/excel-events/excel-events-service