2019-04-23 23:18:19 +02:00
|
|
|
image: docker:stable
|
2019-04-23 23:33:34 +02:00
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- release
|
2019-04-23 23:18:19 +02:00
|
|
|
|
2019-04-23 23:32:02 +02:00
|
|
|
variables:
|
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
|
2019-04-23 23:58:31 +02:00
|
|
|
CONTAINER_TAG_IMAGE: $CI_REGISTRY_IMAGE:${CI_COMMIT_TAG:1}
|
2019-04-23 23:32:02 +02:00
|
|
|
|
2019-04-23 23:13:46 +02:00
|
|
|
before_script:
|
2019-04-23 23:32:02 +02:00
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
2019-04-23 23:13:46 +02:00
|
|
|
|
2019-04-23 23:18:19 +02:00
|
|
|
build:
|
|
|
|
stage: build
|
2019-04-23 23:13:46 +02:00
|
|
|
script:
|
2019-04-24 00:05:44 +02:00
|
|
|
- docker pull $CONTAINER_TEST_IMAGE || true
|
|
|
|
- docker pull $CONTAINER_RELEASE_IMAGE || true
|
|
|
|
- docker pull $CONTAINER_TAG_IMAGE || true
|
2019-04-23 23:32:02 +02:00
|
|
|
- docker build --pull -t $CONTAINER_TEST_IMAGE .
|
|
|
|
- docker push $CONTAINER_TEST_IMAGE
|
|
|
|
|
|
|
|
release-image:
|
|
|
|
stage: release
|
|
|
|
script:
|
|
|
|
- docker pull $CONTAINER_TEST_IMAGE
|
|
|
|
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
|
|
|
|
- docker push $CONTAINER_RELEASE_IMAGE
|
|
|
|
only:
|
|
|
|
- master
|
2019-04-23 23:58:31 +02:00
|
|
|
|
|
|
|
release-tag:
|
|
|
|
stage: release
|
|
|
|
script:
|
|
|
|
- docker pull $CONTAINER_TEST_IMAGE
|
|
|
|
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
|
|
|
|
- docker push $CONTAINER_TAG_IMAGE
|
|
|
|
only:
|
|
|
|
- /^v\d+\.\d+\.\d+/
|
2019-04-24 00:00:04 +02:00
|
|
|
except:
|
2019-04-23 23:58:31 +02:00
|
|
|
- branch
|
|
|
|
|