FROM debian:oldstable

MAINTAINER Pier Carlo Chiodi <pierky@pierky.com>

EXPOSE 179

ENV BIRD_VERSION 2.0.12

RUN apt-get update && apt-get install -y \
        autoconf \
    git \
    bison \
    build-essential \
    curl \
    flex \
    libreadline-dev \
    libncurses5-dev \
    m4 \
    unzip \
    libssh-dev

WORKDIR /root
RUN curl -O -L https://bird.network.cz/download/bird-$BIRD_VERSION.tar.gz
RUN tar -xvzf bird-$BIRD_VERSION.tar.gz

# This directory must be mounted as a local volume with '-v `pwd`/bird:/etc/bird:rw' docker's command line option.
# The host's file at `pwd`/bird/bird.conf is used as the configuration file for BIRD.
RUN mkdir /etc/bird

RUN cd bird-$BIRD_VERSION && \
    autoreconf && \
    ./configure --enable-ipv6 --enable-libssh && \
    make && \
    make install

CMD bird -s /var/run/bird/bird.ctl -c /etc/bird/bird.conf -d