image: docker:1.11.2

stages:
- build
- release

before_script:
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
  - apk add --no-cache coreutils bash git

build:
  stage: build
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
  script:
    - hooks/build 
    - docker push $IMAGE_NAME

release-image:
  stage: release
  script:
    - docker pull $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
    - docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME $CI_REGISTRY_IMAGE:$(cat VERSION)
    - docker push $CI_REGISTRY_IMAGE:$(cat VERSION)
  only:
    - master
image: docker:stable

stages:
- build
- release

before_script:
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
  - apk add --no-cache coreutils bash git

build:
  stage: build
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
  script:
    - hooks/build 
    - docker push $IMAGE_NAME

release-image:
  stage: release
  script:
    - docker pull $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
    - docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME $CI_REGISTRY_IMAGE:$(cat VERSION)
    - docker push $CI_REGISTRY_IMAGE:$(cat VERSION)
  only:
    - master

Update docker image to latest stable version
Update docker image to latest stable version

Signed-off-by: solidnerd <387783e228a6a981e052f1b545e5a6a45a21cc6e@mietz.io>
