-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
80 lines (74 loc) · 1.65 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
stages:
- build
- docker
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
build_backend:
stage: build
image: dockette/mvn
before_script:
- cd backend
script:
- mvn --batch-mode --quiet --fail-at-end compiler:compile war:war
artifacts:
paths:
- backend/target/*.war
expire_in: 1 week
build_frontend:
stage: build
# https://hub.docker.com/_/node/
image: node:7-alpine
cache:
key: "frontend_npm"
paths:
- .npm/
before_script:
- cd frontend
- npm set cache .npm
- npm set fetch-retries 10
script:
- npm install
- npm run build:aot:prod
artifacts:
paths:
- frontend/dist/
build_images:
stage: docker
image: tmaier/docker-compose
only:
- master
dependencies:
- build_backend
- build_frontend
script:
- docker-compose -f docker-compose.yml.prod build --pull
push_images_to_registry:
stage: deploy
image: tmaier/docker-compose
only:
- master
dependencies:
- build_images
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker-compose -f docker-compose.yml.prod push
after_script:
- docker logout $CI_REGISTRY
run_on_server:
stage: deploy
image: tmaier/docker-compose
only:
- master
dependencies:
- build_images
cache:
key: "jukebox-docker-compose_$CI_COMMIT_REF_SLUG"
paths:
- cache/
before_script:
- docker-compose -f ./cache/docker-compose.yml.prod down || docker-compose -f docker-compose.yml.prod down
script:
- docker-compose -f docker-compose.yml.prod up -d
- mkdir -p ./cache && cp docker-compose.yml.prod ./cache/docker-compose.yml.prod