-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
45 lines (39 loc) · 1.03 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
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
GIT_SUBMODULE_STRATEGY: recursive
services:
- docker:dind
stages:
- build
- release
- deploy
build:
stage: build
tags:
- dind
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
- docker build --pull -t "$TEST_IMAGE" .
- docker push "$TEST_IMAGE"
release:
stage: release
tags:
- dind
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
- docker pull "$TEST_IMAGE"
- docker tag "$TEST_IMAGE" "$RELEASE_IMAGE"
- docker push "$RELEASE_IMAGE"
only:
- master
dockerhub:on-schedule:
stage: deploy
only:
- schedules
image: alpine:latest
script:
- apk add --update curl
- 'curl -X POST -H "Content-Type: application/json" --data "{ \"build\": true }" https://cloud.docker.com/api/build/v1/source/$dockerhub_project_trigger_token/trigger/$dockerhub_trigger_token/call/'