---

version: '2'
services:
  etcd:
    image: microbox/etcd
    ports:
      - "4001"
    volumes:
      - ./etcd.data:/data
    command: -name=dkron1

  dkron_python:
    build: .
    restart: unless-stopped
    depends_on:
      - etcd
    ports:
      - "80:8080"
    entrypoint: "/bin/bash -c"
    volumes:
      - "/mnt/flashblade/:/mnt/flashblade"
    # This wonderful hack allows dkron to wait for etcd to be ready and listening on port 4001
    command: '"while ! echo | nc etcd 4001; do sleep 1; done && /opt/local/dkron/dkron agent -server -backend etcd -backend-machine=etcd:4001"'
