kind: pipeline
name: cyclescaler

workspace:
  base: /go
  path: src/deadbeef.codes/steven/cyclescaler

steps:

  - name: build master
    image: golang:latest
    pull: always
    environment:
      GOOS: linux
      GOARCH: amd64
      CGO_ENABLED: 0
    commands:
      - cd master
      - go version
      - go get
      - go build -ldflags '-w'
      - cp /usr/local/go/lib/time/zoneinfo.zip .
      - cp /etc/ssl/certs/ca-certificates.crt .

  - name: containerize master
    image: plugins/docker
    settings:
      repo: registry.deadbeef.codes/cyclescaler-master
      dockerfile: master/Dockerfile

  - name: build slave
    image: golang:latest
    pull: always
    environment:
      GOOS: linux
      GOARCH: amd64
      CGO_ENABLED: 0
    commands:
      - cd slave
      - go version
      - go get
      - go build -ldflags '-w'

  - name: containerize slave
    image: plugins/docker
    settings:
      repo: registry.deadbeef.codes/cyclescaler-slave
      dockerfile: slave/Dockerfile
