# You can specify a custom docker image from Docker Hub as your build environment.
image: python:3.7.2

pipelines:
  default:
    - step:
        services:
          - docker
        script:
          - export DOCKER_HUB_USERNAME=veitveit
          - export DOCKER_HUB_PASSWORD=$dockerpasswd
          - export IMAGE_NAME=veitveit/vsclust
          - docker login --username $DOCKER_HUB_USERNAME --password $dockerpasswd

          # build the Docker image (this will use the Dockerfile in the root of the repo)
          - docker build -t $IMAGE_NAME .
          # authenticate with the Docker Hub registry
          # push the new Docker image to the Docker registry
          - docker push $IMAGE_NAME
          # push a new version of the webserver to biolib
          #- pip3 install pybiolib
          #- cd webserver && biolib push SDU/VSClust
  tags: 
    release-*:
    - step:
        services:
          - docker
        script: 
          - export DOCKER_HUB_USERNAME=veitveit
          - export DOCKER_HUB_PASSWORD=$dockerpasswd
          - export IMAGE_NAME=veitveit/vsclust:$BITBUCKET_TAG
          - docker login --username $DOCKER_HUB_USERNAME --password $dockerpasswd

          # build the Docker image (this will use the Dockerfile in the root of the repo)
          - docker build -t $IMAGE_NAME .
          # authenticate with the Docker Hub registry
          # push the new Docker image to the Docker registry
          - docker push $IMAGE_NAME
          # push a new version of the webserver to biolib
          #- pip3 install pybiolib
          #- cd webserver && biolib push SDU/VSClust

definitions:
  services:
    docker:
      memory: 2048