-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
71 lines (64 loc) · 1.43 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
stages:
- dependencies
- build
- package
- deploy
.build_on: &build_on
- dev
- tags
- /^.+-hotfix$/
install_dependencies:
image: alexproca/docker-node-yarn
only: *build_on
stage: dependencies
artifacts:
paths:
- node_modules/
script:
- yarn install --cache-folder /cache/.yarn
build_app:
image: alexproca/docker-node-yarn
only: *build_on
stage: build
dependencies:
- install_dependencies
artifacts:
paths:
- dist/
script:
- yarn build --cache-folder /cache/.yarn
build_server:
image: alexproca/docker-node-yarn
only: *build_on
stage: build
dependencies:
- install_dependencies
artifacts:
paths:
- dist/
script:
- yarn server --cache-folder /cache/.yarn
build_modules:
image: alexproca/docker-node-yarn
only: *build_on
stage: build
artifacts:
paths:
- dist/
script:
- yarn install --cache-folder /app/.yarn --production --modules-folder ./dist/node_modules
build_image:
image: docker:latest
only: *build_on
stage: package
services:
- docker:dind
dependencies:
- build_app
- build_server
- build_modules
script:
- export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum:]_.-' '-')
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"