<commit_before>image: registry.timmertech.nl/docker/docker:latest

stages:
  - build
  - dockerhub

.docker-login: &docker-login
  before_script:
    - echo ${CI_JOB_TOKEN} | docker login -u gitlab-ci-token --password-stdin ${CI_REGISTRY}

.docker-build: &docker-build
  script:
    - docker build --pull --force-rm=true --squash 
        --build-arg VCS_REF=`git rev-parse --short HEAD` 
        --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` 
        --tag=${DOCKER_IMAGE} .
    
.docker-push: &docker-push
  script:
    - docker push ${DOCKER_IMAGE}

docker:latest:
  stage: build
  only:
    - master
    - tags
  variables:
    DOCKER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest
  <<: *docker-login
  <<: *docker-build
  <<: *docker-push

docker:branches:
  stage: build
  only:
    - branches
  except:
    - master
    - tags
  variables:
    DOCKER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME}
  <<: *docker-login
  <<: *docker-build

dockerhub:latest:
  stage: dockerhub
  only:
    - master
  script:
    - curl -s -H 'Content-Type:application/json' --data '{"build":true}' -X POST https://registry.hub.docker.com/u/datacore/gitlab-runner/trigger/${DOCKERHUB_TOKEN}/ > /dev/null
<commit_msg>Update CI<commit_after>image: registry.timmertech.nl/docker/docker:latest

stages:
  - build
  - dockerhub

.docker-login: &docker-login
  before_script:
    - echo ${CI_JOB_TOKEN} | docker login -u gitlab-ci-token --password-stdin ${CI_REGISTRY}

.docker-build: &docker-build
  script:
    - docker build --pull --force-rm=true --squash 
        --build-arg VCS_REF=`git rev-parse --short HEAD` 
        --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` 
        --tag=${DOCKER_IMAGE} .
    
.docker-push: &docker-push
  after_script:
    - docker push ${DOCKER_IMAGE}

docker:latest:
  stage: build
  only:
    - master
  variables:
    DOCKER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest
  <<: *docker-login
  <<: *docker-build
  <<: *docker-push

docker:branches:
  stage: build
  only:
    - branches
  except:
    - master
    - tags
  variables:
    DOCKER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME}
  <<: *docker-login
  <<: *docker-build

docker:release:
  stage: build
  only:
    - tags
  variables:
    DOCKER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME}
  <<: *docker-login
  <<: *docker-build
  <<: *docker-push

dockerhub:latest:
  stage: dockerhub
  only:
    - master
  except:
    - tags
  script:
    - curl -s -H 'Content-Type:application/json' --data '{"build":true}' -X POST https://registry.hub.docker.com/u/datacore/gitlab-runner/trigger/${DOCKERHUB_TOKEN}/ > /dev/null

dockerhub:release:
  stage: dockerhub
  only:
    - tags
  script:
    - curl -s -H 'Content-Type:application/json' --data "{\"source_type\":\"Tag\",\"source_name\":\"${CI_COMMIT_REF_NAME}\"}" -X POST https://registry.hub.docker.com/u/datacore/gitlab-runner/trigger/${DOCKERHUB_TOKEN}/ > /dev/null

{'fraction_non_alphanumeric': 0.16565656565656567, 'fraction_numerical': 0.0, 'mean_word_length': 3.0866574965612106, 'pattern_counts': {'":': 4, '<': 29, '<?xml version=': 0, '>': 6, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3252040', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1124, 'n_words': 191}