kind: pipeline
type: docker
name: run_tests

volumes:
- name: docker_sock
  host:
    path: /var/run/docker.sock

steps:
- name: build and test in docker image
  image: docker
  volumes:
  - name: docker_sock
    path: /var/run/docker.sock
  commands:
  - docker build --build-arg STAGE=test -t mytestimage .
  - docker run mytestimage python -m pytest test
  when:
    event: [push]