You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
928B

  1. # This file is a template, and might need editing before it works on your project.
  2. # Official docker image.
  3. image: docker:latest
  4. services:
  5. - docker:dind
  6. before_script:
  7. - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  8. build-master:
  9. stage: build
  10. script:
  11. - docker build --pull -t "$CI_REGISTRY_IMAGE" .
  12. - docker push "$CI_REGISTRY_IMAGE"
  13. - docker tag "$CI_REGISTRY_IMAGE" "$CI_REGISTRY_IMAGE:v$(date -u +%Y%m%d)"
  14. - docker push "$CI_REGISTRY_IMAGE:v$(date -u +%Y%m%d)"
  15. only:
  16. - master
  17. build:
  18. stage: build
  19. script:
  20. - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
  21. - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
  22. - docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-v$(date -u +%Y%m%d)"
  23. - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-v$(date -u +%Y%m%d)"
  24. except:
  25. - master