-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
40 lines (36 loc) · 1.02 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
stages:
- build
- test
- deploy
# build:
# stage: build
# services:
# - docker:dind
# image: docker:latest
# before_script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# script:
# - docker pull $CI_REGISTRY_IMAGE:latest || true
# - docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
# - docker push $CI_REGISTRY_IMAGE:latest
# test:
# stage: test
# image: golang:1.14.9-buster
# script:
# - go test ./
deploy:
stage: deploy
before_script:
- mkdir -p .ssh
- chmod 700 .ssh
- echo "$SSH_PRIVATE_KEY" >> .ssh/rsa
- chmod 700 .ssh/rsa
script:
- |
ssh -o StrictHostKeyChecking=no -i .ssh/rsa $HOST -tt "
cd million-singer
git pull origin master
sed -i 's/server_git_commit_sha=/server_git_commit_sha=$CI_COMMIT_SHORT_SHA/' env/.env-docker-compose
docker-compose up -d --build
"