sudo: required

language: node_js
node_js:
  - "8"

cache:
  yarn: true
  directories:
    - node_modules

services:
  - docker

jobs:
  include:
    - stage: test
      script:
        - echo "Testing..."
    - stage: build
      script:
        - docker build . -t quay.io/uzh-bf/klicker-react:latest
        - docker login -u$QUAY_USER -p$QUAY_TOKEN quay.io/uzh-bf/klicker-react
        - docker push quay.io/uzh-bf/klicker-react:latest
    - stage: deploy
      script:
        - echo "Deploying..."

sudo: required

language: node_js
node_js:
  - "8"

services:
  - docker

jobs:
  include:
    - stage: test
      script:
        - echo "Testing..."
      cache:
        yarn: true
        directories:
          - node_modules

    - stage: build
      script:
        - docker login -u$QUAY_USER -p$QUAY_TOKEN quay.io/uzh-bf/klicker-react
        - docker pull quay.io/uzh-bf/klicker-react:latest
        - docker build --cache-from quay.io/uzh-bf/klicker-react:latest -t quay.io/uzh-bf/klicker-react:latest .
        - docker push quay.io/uzh-bf/klicker-react:latest

    - stage: deploy
      script:
        - echo "Deploying..."

Move cache to test stage, add cache-from for docker build
Move cache to test stage, add cache-from for docker build
