This repository has been archived by the owner on May 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
103 lines (98 loc) · 2.94 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# cache:
# key: "$CI_BUILD_REF_NAME php:7.2"
stages:
- test
- build
- deploy
services:
- name: mariadb:latest
alias: db
test:
stage: test
image: php:7.2
except:
- "master"
variables:
MYSQL_DATABASE: sharetoall
MYSQL_USER: sharetoall
MYSQL_PASSWORD: sharetoall
MYSQL_ROOT_PASSWORD: sharetoall
MYSQL_HOST: db
APP_VERSION: '1.0'
APP_DOMAIN: sharetoall.loc
APP_URL: 'http://sharetoall.loc'
APP_REDIRECT_URI: 'http://sharetoall.loc/redirect/'
APP_EMAIL: root@localhost
APP_LOCALE: en
DB_HOST: db
DB_PORT: 3306
DB_NAME: sharetoall
DB_USER: sharetoall
DB_PASSWORD: sharetoall
REDIS_HOST: redis
REDIS_PORT: 6379
MINIFIED_JS: 1
MINIFIED_CSS: 1
MAILER_HOST: mailhog
MAILER_PORT: 1025
MAILER_ENCRYPTION: ''
MAILER_USERNAME: ''
MAILER_PASSWORD: ''
MAILER_AUTH_MODE: ''
FEATURE_EXAMPLE: 1
TWITTER_CONSUMER_KEY: ''
TWITTER_CONSUMER_SECRET: ''
LINKEDIN_CONSUMER_KEY: ''
LINKEDIN_CONSUMER_SECRET: ''
GOOGLE_TOKEN: ''
before_script:
- bash ci/docker_install.sh > /dev/null
script:
- bin/phing build-database
- phpunit --configuration phpunit.xml
# - bin/phing test-acceptance
build:
stage: build
image: gitlab/dind:latest
only:
- "develop"
services:
- docker:dind
variables:
DOCKER_DRIVER: "overlay"
before_script:
- docker version
- "docker info"
- "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"
script:
- "docker-compose -f docker-compose-release.yml build --pull"
- "docker-compose -f docker-compose-release.yml push"
after_script:
- "docker logout ${CI_REGISTRY}"
deploy:
stage: deploy
image: gitlab/dind:latest
only:
- "master"
environment: production
services:
- docker:dind
before_script:
- mkdir -p ~/.ssh
- echo "$DEPLOY_SERVER_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- ssh-keyscan -H $DEPLOYMENT_SERVER_IP >> ~/.ssh/known_hosts
script:
- ssh hypnos@$DEPLOYMENT_SERVER_IP "docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY};
cd /usr/share/nginx/html/sharetoall;
docker-compose -f docker-compose.prod.yml stop;
docker-compose -f docker-compose.prod.yml rm -f;
docker volume rm sharetoall_public;
docker pull ${CI_REGISTRY}/${CI_PROJECT_PATH}:php-latest;
docker pull ${CI_REGISTRY}/${CI_PROJECT_PATH}:redis-latest;
docker pull ${CI_REGISTRY}/${CI_PROJECT_PATH}:web-latest;
docker-compose -f docker-compose.prod.yml up -d --force-recreate"
after_script:
- "docker logout ${CI_REGISTRY}"