#
# Example Alpine Dockerfile
#

FROM alpine:3

ARG NFDUMP_VERSION=1.7.3

WORKDIR /tmp

ADD https://github.com/phaag/nfdump/archive/refs/tags/v$NFDUMP_VERSION.tar.gz /tmp
RUN \
  apk add --no-cache build-base gcc abuild binutils make &&
  apk add --no-cache libtool bzip2-dev libpcap-dev flex bison &&
  apk add --no-cache autoconf automake m4 pkgconfig

RUN \
  tar zxf v$NFDUMP_VERSION.tar.gz &&
  cd /tmp/nfdump-$NFDUMP_VERSION &&
  ./autogen.sh &&
  ./configure --enable-maxmind --enable-nfpcapd --enable-sflow=yes &&
  make &&
  cd /tmp/nfdump-$NFDUMP_VERSION && make install &&
  cd .. &&
  rm -rf nfdump-v$NFDUMP_VERSION &&
  rm /tmp/v$NFDUMP_VERSION.tar.gz &&
  apk del build-base gcc flex bison autoconf automake m4 pkgconfig

VOLUME /data

CMD ["nfcapd", "-w", "/data", "-S", "1", "-y", "-p", "9999"]
