-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
78 lines (71 loc) · 1.69 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
image: node:12
stages:
- dependencias
- build
- containerization
- deploy
cache:
paths:
- node_modules/
install_dependencies:
timeout: 180m
stage: dependencias
script:
- npm install
artifacts:
paths:
- node_modules/
build:
timeout: 180m
stage: build
script:
- docker build -t $BUILD_TAG .
register_image:
stage: containerization
variables:
SHA: $CI_COMMIT_SHORT_SHA
script:
- docker tag $BUILD_TAG $DOCKER_SERVER/$BUILD_TAG:$SHA
- docker tag $BUILD_TAG $DOCKER_SERVER/$BUILD_TAG:latest
- docker push $DOCKER_SERVER/$BUILD_TAG:$SHA
- docker push $DOCKER_SERVER/$BUILD_TAG:latest
only:
- master
deploy_to_desarrollo:
stage: deploy
variables:
MYSQL_SERVER: $DESA_MYSQL_SERVER
MYSQL_USER: $DESA_MYSQL_USER
MYSQL_PW: $DESA_MYSQL_PASS
MYSQL_DB: $DESA_MYSQL_DB
MYSQL_PORT: $DESA_MYSQL_PORT
APP_PORT: $APP_PORT
DEPLOY_TAG: $BUILD_TAG
script:
- echo $DEPLOY_TAG
- docker-compose down
- docker-compose up -d
only:
- desarrollo
tags:
- desarrollo
deploy_to_prod:
stage: deploy
variables:
MYSQL_SERVER: $PROD_MYSQL_SERVER
MYSQL_USER: $DESA_MYSQL_USER
MYSQL_PW: $DESA_MYSQL_PASS
MYSQL_DB: $DESA_MYSQL_DB
MYSQL_PORT: $DESA_MYSQL_PORT
APP_PORT: $APP_PORT
DEPLOY_TAG: $DOCKER_SERVER/$BUILD_TAG:latest
script:
- echo $DEPLOY_TAG
- docker pull $DEPLOY_TAG
- docker-compose down
- docker-compose up -d
only:
- master
when: manual
tags:
- master