FROM alpine:3.18.0 as builder
ARG VERSION=v3.0-alpha2

RUN apk update && apk add bison flex ncurses-dev readline-dev linux-headers libssh-dev \
    linux-headers git alpine-sdk git readline-dev autoconf
RUN cd / && git clone https://gitlab.nic.cz/labs/bird.git
WORKDIR /bird
RUN git checkout ${VERSION}
RUN autoreconf -i && \
    ./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/run \
    && make
#RUN make install

FROM alpine:3.18.0
LABEL org.opencontainers.image.authors="nico.schottelius@ungleich.ch"
RUN apk add --no-cache libssh readline ncurses
COPY --from=0 /bird/bird /usr/sbin/
COPY --from=0 /bird/birdc /usr/sbin/
COPY --from=0 /bird/birdcl /usr/sbin/
COPY --from=0 /bird/doc/bird.conf.example /etc/bird.conf

ENTRYPOINT ["/usr/sbin/bird" ]
CMD ["-f"]
