.gitlab-ci.yml 583 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
---
image: docker:latest

variables:
  DOCKER_DRIVER: overlay
  DOCKER_BRANCH: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
  DOCKER_LATEST: $CI_REGISTRY_IMAGE:latest

stages:
  - branch
  - latest

13 14 15
before_script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
branch_image:
  stage: branch
  script:
    - docker build --pull -t $DOCKER_BRANCH .
    - docker push $DOCKER_BRANCH

latest_image:
  stage: latest
  dependencies:
    - branch_image
  only:
    refs:
      - master
  script:
    - docker tag $DOCKER_BRANCH $DOCKER_LATEST
    - docker push $DOCKER_LATEST