forked from publicarray/docker-ntpsec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
215 lines (199 loc) · 6.25 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
image: docker:stable
services:
- docker:stable-dind
.build_template: &build_template
stage: build
before_script:
- IMAGE_NAME=${CI_JOB_NAME%_*}
- export IMAGE_NAME=${IMAGE_NAME/-/\/}
- export IMAGE_TAG=${CI_JOB_NAME#*_}
- export IMAGE=$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
script: &build_script
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $IMAGE || true
- >
docker build
--pull
--cache-from $IMAGE
--rm=false
--tag $IMAGE .
--file $CI_JOB_NAME
- docker push $IMAGE
.deploy_template:
<<: *build_template
stage: deploy
script: &deploy_script
- export DHUB_IMAGE_NAME=$DOCKER_HUB_USER/$IMAGE_NAME
- docker logout
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_TOKEN docker.io
- docker tag $IMAGE $DOCKER_HUB_USER/$IMAGE_NAME:$IMAGE_TAG
builder-alpine_3.12: # builder/alpine:3.12
extends: .build_template
only:
changes:
- ntpsec_alpine3.12
- builder-alpine_3.12
- ntp.conf
ntpsec_alpine3.12: # ntpsec:alpine
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:latest # Core Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:alpine # Alpine Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:alpine-latest # Alpine Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:alpine3
- docker tag $IMAGE $DHUB_IMAGE_NAME:alpine3.12
- docker tag $IMAGE $DHUB_IMAGE_NAME:alpine3.12.0
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-alpine # Alpine Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-alpine3
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-alpine3.12
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-alpine3.12.0
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-alpine_3.12"]
only:
changes:
- ntpsec_alpine3.12
- builder-alpine_3.12
- ntp.conf
builder-alpine_edge: # builder/alpine:edge
extends: .build_template
only:
changes:
- ntpsec_alpine-edge
- builder-alpine_edge
- ntp.conf
ntpsec_alpine-edge: # ntpsec:alpine-edge
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:alpine-edge
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-alpine-edge
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-alpine_edge"]
only:
changes:
- ntpsec_alpine-edge
- builder-alpine_edge
- ntp.conf
builder-centos_8: # builder/centos:8
extends: .build_template
only:
changes:
- ntpsec_centos8
- builder-centos_8
- ntp.conf
ntpsec_centos8: # ntpsec:8
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:centos # CentOS Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:centos-latest # CentOS Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:centos8
- docker tag $IMAGE $DHUB_IMAGE_NAME:centos8.2
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-centos # CentOS Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-centos8
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-centos8.2
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-centos_8"]
only:
changes:
- ntpsec_centos8
- builder-centos_8
- ntp.conf
builder-debian_10: # builder/debian:10
extends: .build_template
only:
changes:
- ntpsec_debian10
- builder-debian10
- ntp.conf
ntpsec_debian10: # ntpsec:10
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian-buster
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian10
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian10.4
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian10
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian10.4
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-debian_10"]
only:
changes:
- ntpsec_debian10
- builder-debian10
- ntp.conf
builder-debian_10-slim: # builder/debian:10-slim
extends: .build_template
only:
changes:
- ntpsec_debian10-slim
- builder-debian_10-slim
- ntp.conf
ntpsec_debian10-slim: # ntpsec:debian10-slim
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian # Debian Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian-latest # Debian Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian-slim
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian10-slim
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian10.4-slim
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian # Debian Latest
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian-slim
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian10-slim
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian10.4-slim
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-debian_10-slim"]
only:
changes:
- ntpsec_debian10-slim
- builder-debian_10-slim
- ntp.conf
builder-debian_testing: # builder/debian:testing
extends: .build_template
only:
changes:
- ntpsec_debian_testing
- builder-debian_testing
- ntp.conf
ntpsec_debian-testing: # ntpsec:debian-testing
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian-testing
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian-testing
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-debian_testing"]
only:
changes:
- ntpsec_debian_testing
- builder-debian_testing
- ntp.conf
builder-debian_testing-slim: # builder/debian:testing-slim
extends: .build_template
only:
changes:
- ntpsec_debian_testing-slim
- builder-debian_testing-slim
- ntp.conf
ntpsec_debian-testing-slim: # ntpsec:debian-testing-slim
extends: .deploy_template
script:
- *build_script
- *deploy_script
- docker tag $IMAGE $DHUB_IMAGE_NAME:debian-testing-slim
- docker tag $IMAGE $DHUB_IMAGE_NAME:1.1.9-debian-testing-slim
- docker push docker.io/$DOCKER_HUB_USER/$IMAGE_NAME
needs: ["builder-debian_testing-slim"]
only:
changes:
- ntpsec_debian_testing-slim
- builder-debian_testing-slim
- ntp.conf