-
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: docker:latest
cache:
key: cache_npm
paths:
- .npm
stages:
- npm
- create_image
# - test
- deploy
variables:
CONTAINER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}
CONTAINER_IMAGE_TAG: ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME}
CONTAINER_IMAGE_CONCAT: ${CI_PROJECT_PATH_SLUG}-${CI_COMMIT_REF_NAME}
APP_PATH: /project
npm:
stage: npm
image: node:6.9.2
before_script:
- npm config set cache ./.npm
script:
- git log -1 --format=medium > last_commit_message.txt
- cat last_commit_message.txt
- npm install
- npm run build
variables:
NODE_ENV: development
# NODE_ENV: production
artifacts:
paths:
# - .npm/
# - node_modules/
- build/
- last_commit_message.txt
only:
- master
create_image:
stage: create_image
image: docker:latest
script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker build -t ${CONTAINER_IMAGE} .
- docker tag ${CONTAINER_IMAGE} ${CONTAINER_IMAGE_TAG}
- docker push ${CONTAINER_IMAGE}
- docker push ${CONTAINER_IMAGE_TAG}
dependencies:
- npm
only:
- master
# test:
# stage: test
# image: docker:latest
# script:
# - echo "ok"
# only:
# - master
depoy:
stage: deploy
script:
- echo "docker stack deploy --with-registry-auth --compose-file=docker-compose.yml ${CONTAINER_IMAGE_CONCAT}"
- docker stack deploy --with-registry-auth --compose-file=docker-compose.yml ${CONTAINER_IMAGE_CONCAT}
environment:
name: master
url: https://bratishka.mgbeta.ru
variables:
STAGE: master
only:
- master
# tags: # FOR RUNNER!
# - master
# when: manual