.gitlab-ci.yml 641 Bytes
Newer Older
Mathieu Courcelles's avatar
Mathieu Courcelles committed
1 2 3 4 5
before_script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY

build:
  script:
6
    - docker build  --build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA -t $CI_REGISTRY_IMAGE:build .
Mathieu Courcelles's avatar
Mathieu Courcelles committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
    - docker push $CI_REGISTRY_IMAGE:build
  stage: build


deploy:
  environment: production
  only:
    - master
  script:
    - export TODAY=$(date +"%Y.%m.%d")
    - docker pull $CI_REGISTRY_IMAGE:build
    - docker tag $CI_REGISTRY_IMAGE:build $CI_REGISTRY_IMAGE:latest
    - docker tag $CI_REGISTRY_IMAGE:build $CI_REGISTRY_IMAGE:$TODAY
    - docker push $CI_REGISTRY_IMAGE:latest
    - docker push $CI_REGISTRY_IMAGE:$TODAY
  stage: deploy