forked from Mumie-hub/docker-services
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
95 lines (86 loc) · 2.41 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
#image: gitlab/dind
variables:
# REGISTRY: registry.example.com
# REGISTRY_NAME: mumie
REPO1: rclone-mount
REPO2: smb-mount
REPO3: jdownloader
REGPATH: $CI_REGISTRY/$CI_PROJECT_PATH
# LATEST_VER: mumie/app:latest
# MAJOR_VER: mumie/app:2
stages:
- build
- test
before_script:
- echo "starting new job in $REGPATH"
- docker info
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
docker_build_repo1:
stage: build
image: docker:latest
services:
- docker:dind
script:
- echo "$CI_PROJECT_PATH"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $REGPATH/$REPO1:$CI_COMMIT_REF_SLUG || true
- docker build --pull -t $REGPATH/$REPO1:$CI_COMMIT_SHA -t $REGPATH/$REPO1:$CI_COMMIT_REF_SLUG ./$REPO1
- docker push $REGPATH/$REPO1:$CI_COMMIT_SHA
- docker push $REGPATH/$REPO1:$CI_COMMIT_REF_SLUG
only:
- dev
- master
docker_build_repo2:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $REGPATH/$REPO2:$CI_COMMIT_REF_SLUG || true
- docker build --pull --cache-from $REGPATH/$REPO2:$CI_COMMIT_REF_SLUG -t $REGPATH/$REPO2:$CI_COMMIT_SHA -t $REGPATH/$REPO2:$CI_COMMIT_REF_SLUG ./$REPO2
- docker push $REGPATH/$REPO2:$CI_COMMIT_SHA
- docker push $REGPATH/$REPO2:$CI_COMMIT_REF_SLUG
only:
- dev
docker_build_repo3:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $REGPATH/$REPO3:$CI_COMMIT_REF_SLUG || true
- docker build --pull --cache-from $REGPATH/$REPO3:$CI_COMMIT_REF_SLUG -t $REGPATH/$REPO3:$CI_COMMIT_SHA -t $REGPATH/$REPO3:$CI_COMMIT_REF_SLUG ./$REPO3
- docker push $REGPATH/$REPO3:$CI_COMMIT_SHA
- docker push $REGPATH/$REPO3:$CI_COMMIT_REF_SLUG
only:
- dev
#docker_build2:
# stage: build
# script:
# - docker info
# - docker build -t $LATEST_VER -t $MAJOR_VER .
docker_push1:
stage: test
image: docker:latest
services:
- docker:dind
script:
- echo "finished"
# - do some test
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
only:
- dev
docker_push2:
stage: test
image: docker:latest
services:
- docker:dind
script:
- echo "manual Job done"
# - do some test
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
only:
- dev
when: manual