.gitlab-ci.yml 797 Bytes
Newer Older
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
image: clarinpl/python:3.6

cache:
  paths:
    - .tox

stages:
  - build

before_script:
  - pip install tox==2.9.1

build_image:
  stage: build
Bartosz Ziemba's avatar
Bartosz Ziemba committed
15
  image: 'docker:18.09.7'
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
16 17 18
  only:
    - master
  services:
Bartosz Ziemba's avatar
Bartosz Ziemba committed
19 20 21
    - 'docker:18.09.7-dind'
  variables:
    DOCKERHUB_NAME: clarinpl/$CI_PROJECT_NAME
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
22 23 24
  before_script:
    - ''
  script:
Bartosz Ziemba's avatar
Bartosz Ziemba committed
25
    - docker build -t $DOCKERHUB_NAME .
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
26 27 28
    - echo $DOCKER_PASSWORD > pass.txt
    - cat pass.txt | docker login --username $DOCKER_USERNAME --password-stdin
    - rm pass.txt
Bartosz Ziemba's avatar
Bartosz Ziemba committed
29 30 31 32 33 34
    - docker push $DOCKERHUB_NAME
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker image tag $DOCKERHUB_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
    - docker image tag $DOCKERHUB_NAME $CI_REGISTRY_IMAGE:latest
    - docker push $CI_REGISTRY_IMAGE