-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
39 lines (37 loc) · 1.15 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
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
stages:
- test
- build
- deploy
test:
stage: test
script:
- docker build -t tests -f Tests.Dockerfile .
- docker run tests
tags:
- docker
build:
stage: build
script:
- docker login -u excelmec -p $DOCKER_HUB_PASSWORD
- docker build -t excelmec/accounts-api:staging -f Production.Dockerfile .
- docker push excelmec/accounts-api:staging
tags:
- docker
only:
- master@excel-mec/excel-accounts/Excel-Accounts-Backend
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-Accounts-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-accounts/Excel-Accounts-Backend