-
Notifications
You must be signed in to change notification settings - Fork 16
/
.gitlab-ci.yml
39 lines (35 loc) · 1.1 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
image: docker:stable
stages:
- package
- release
variables:
STAGING_REGISTRY: "registry.gitlab.com"
CONTAINER_TEST_IMAGE: ${STAGING_REGISTRY}/bigdataboutique/${CI_PROJECT_NAME}:commit-${CI_COMMIT_SHA}
package:
stage: package
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $STAGING_REGISTRY
script:
- docker build --tag $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
release:
stage: release
cache: {}
services:
- docker:dind
variables:
GIT_STRATEGY: none
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $STAGING_REGISTRY
script:
- IMAGE_NAME=${STAGING_REGISTRY}/bigdataboutique/${CI_PROJECT_NAME}:`date '+%Y-%m-%d-%H%M'`-${CI_COMMIT_SHA:0:9}
- echo $IMAGE_NAME
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $IMAGE_NAME
- docker push $IMAGE_NAME
- docker tag $CONTAINER_TEST_IMAGE ${STAGING_REGISTRY}/bigdataboutique/${CI_PROJECT_NAME}:latest
- docker push ${STAGING_REGISTRY}/bigdataboutique/${CI_PROJECT_NAME}:latest
only:
- master