stages:
    - test
    - docker-dev

variables:
    DOCKER_HUB_USERNAME: ""
    DOCKER_HUB_PASSWORD: ""

.docker:
    variables:
        DOCKER_IMAGE:
        DOCKER_FILE:
    script:
        - docker build -t $DOCKER_IMAGE -f $DOCKER_FILE .
        - docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD
        - docker push inty/opmuse-dev
    only:
        - /^develop$/

pycodestyle:
    stage: test
    image: inty/opmuse-test
    script:
        - pip3 install -r dev-requirements.txt
        - pycodestyle --ignore=E501,W504,E722,E261 opmuse
    only:
        - branches

pytest:
    stage: test
    image: inty/opmuse-test
    script:
        - pip3 install -r requirements.txt -r dev-requirements.txt
        - yarn
        - cp config/opmuse.dist.ini config/opmuse.ini
        - yarn build:dev
        - pytest -o log_cli=true --verbose opmuse/test
    only:
        - branches

docker-dev:
    extends: .docker
    stage: docker-dev
    variables:
        DOCKER_IMAGE: inty/opmuse-dev
        DOCKER_FILE: Dockerfile.dev


stages:
    - test
    - docker-dev

variables:
    DOCKER_HUB_USERNAME: ""
    DOCKER_HUB_PASSWORD: ""

.docker:
    variables:
        DOCKER_IMAGE:
        DOCKER_FILE:
    image: docker:dind
    script:
        - docker build -t $DOCKER_IMAGE -f $DOCKER_FILE .
        - docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD
        - docker push inty/opmuse-dev
    only:
        - /^develop$/

pycodestyle:
    stage: test
    image: inty/opmuse-test
    script:
        - pip3 install -r dev-requirements.txt
        - pycodestyle --ignore=E501,W504,E722,E261 opmuse
    only:
        - branches

pytest:
    stage: test
    image: inty/opmuse-test
    script:
        - pip3 install -r requirements.txt -r dev-requirements.txt
        - yarn
        - cp config/opmuse.dist.ini config/opmuse.ini
        - yarn build:dev
        - pytest -o log_cli=true --verbose opmuse/test
    only:
        - branches

docker-dev:
    extends: .docker
    stage: docker-dev
    variables:
        DOCKER_IMAGE: inty/opmuse-dev
        DOCKER_FILE: Dockerfile.dev


Use docker:dind to build docker in docker
Use docker:dind to build docker in docker
