-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
51 lines (45 loc) · 1.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
image: docker:stable
stages:
- build
- release
services:
- docker:dind
variables:
STAGING_REGISTRY: "registry.gitlab.com"
CONTAINER_TEST_IMAGE: ${STAGING_REGISTRY}/bigdataboutique/${CI_PROJECT_NAME}:${CI_COMMIT_SHA}
CONTAINER_LATEST_IMAGE: ${STAGING_REGISTRY}/bigdataboutique/${CI_PROJECT_NAME}:latest
build:
stage: build
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $STAGING_REGISTRY
script:
- docker build -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
release:
stage: release
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $STAGING_REGISTRY
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_LATEST_IMAGE
- docker push $CONTAINER_LATEST_IMAGE
only:
- master
dockerhub:
stage: release
variables:
GIT_STRATEGY: none
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $STAGING_REGISTRY
- docker login -u $DOCKERHUB_USER -p "$DOCKERHUB_PASSWORD" docker.io
script:
- IMAGE_NAME=bigdataboutique/${CI_PROJECT_NAME}:${CI_COMMIT_TAG}
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $IMAGE_NAME
- docker push $IMAGE_NAME
- docker tag $CONTAINER_TEST_IMAGE bigdataboutique/${CI_PROJECT_NAME}:latest
- docker push bigdataboutique/${CI_PROJECT_NAME}:latest
only:
- /^v.*$/
except:
- branches