version: '3'

services:
  test:
    build:
      context: .
      dockerfile: Dockerfile.unittest
    cap_add:
      - cap_net_admin
      - cap_net_raw
    volumes:
      - ${PWD}:/src
      - ${HOME}/.cache/go-build:/go/pkg/mod
    working_dir: /src
    environment:
      - GOCACHE=/go/pkg/mod
      - FOCUS
    depends_on:
      - dhcpd
    networks:
      - dhcp

  dhcpd:
    image: networkboot/dhcpd
    cap_add:
      - cap_net_raw
    volumes:
      - ${PWD}/test/data:/data
    networks:
      dhcp:
        ipv4_address: 172.99.0.2
    command: eth0

networks:
  dhcp:
    ipam:
      driver: default
      config:
        - subnet: 172.99.0.0/16
