Skip to content
Snippets Groups Projects
.gitlab-ci.yml 797 B
Newer Older
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
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
  image: 'docker:18.09.7'
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
  only:
    - master
  services:
Bartosz Ziemba's avatar
Bartosz Ziemba committed
    - 'docker:18.09.7-dind'
  variables:
    DOCKERHUB_NAME: clarinpl/$CI_PROJECT_NAME
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
  before_script:
    - ''
  script:
Bartosz Ziemba's avatar
Bartosz Ziemba committed
    - docker build -t $DOCKERHUB_NAME .
Tomasz Walkowiak's avatar
Tomasz Walkowiak committed
    - 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
    - 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