---
kind: pipeline
type: kubernetes
name: default

steps:
- name: build-push
  image: docker:dind
  volumes:
  - name: dockersock
    path: /var/run
  environment:
    DOCKER_USER:
      from_secret: DOCKER_USER
    DOCKER_PASSWORD:
      from_secret: DOCKER_PASSWORD
  commands:
  - sleep 5 ## give docker enough time to start
  - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
  - docker build ./golang -t aimvector/golang:1.0.0
  - docker push aimvector/golang:1.0.0

services:
- name: docker
  image: docker:dind
  privileged: true
  volumes:
  - name: dockersock
    path: /var/run
volumes:
- name: dockersock
  temp: {}