Skip to content

Commit

Permalink
add bird
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieugouel committed Nov 12, 2024
0 parents commit b2ac3ef
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Create and publish a Docker image
on:
push:
branches: [ "main" ]
workflow_run:
workflows: [ "Rust" ]
types:
- completed

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./bird/Dockerfile
image: ghcr.io/nxthdr/bird
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@0de3687b53cd804b63dd87819f7bda043569ce4a
with:
images: ${{ matrix.image }}

- name: Sync theme submodule
run: git submodule sync && git submodule update --init --recursive

- name: Build and push Docker image
id: push
uses: docker/build-push-action@5e99dacf67635c4f273e532b9266ddb609b3025a
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ matrix.image }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
Empty file added LICENSE
Empty file.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Docker Images

Generating Docker images for external applications, when necessary.
Images for nxthdr's software are generated in each repository.
48 changes: 48 additions & 0 deletions bird/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM ubuntu:24.04 AS builder

ARG BIRD_VERION=2.15.1
ARG BIRD_PROTOCOLS=bmp,bgp,rpki,static

RUN apt update -y && \
apt install -y --no-install-recommends --no-install-suggests \
bison \
ca-certificates \
curl \
flex \
gcc \
libncurses-dev \
libreadline-dev \
libssh-dev \
m4 \
make \
&& rm -rf /var/lib/apt/lists/*

RUN curl -o /tmp/bird-${BIRD_VERION}.tar.gz https://bird.network.cz/download/bird-${BIRD_VERION}.tar.gz
RUN tar xvzf /tmp/bird-${BIRD_VERION}.tar.gz -C /tmp

RUN cd /tmp/bird-${BIRD_VERION} \
&& ./configure \
--prefix=/usr/ \
--sysconfdir=/etc/bird/ \
--localstatedir=/var/ \
--enable-libssh \
--with-protocols=${BIRD_PROTOCOLS} \
&& make && make install \
&& { find /usr/sbin/bird* -type f -executable -exec strip --strip-all "{}" +; }

FROM ubuntu:24.04

RUN set -eux \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends --no-install-suggests \
iproute2 \
libtinfo6 \
libreadline8 \
libssh-4 \
&& rm -rf /var/lib/apt/lists/* /var/log/*

COPY --from=builder /usr/sbin/bird* /usr/sbin/
COPY --from=builder /etc/bird/ /etc/bird/

EXPOSE 179/tcp
CMD ["bird", "-f", "-R"]
7 changes: 7 additions & 0 deletions bird/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bird

This Dockerfile is heavilly inspired by https://github.com/akafeng/docker-bird (Apache License 2.0).
Thanks @akafeng!

The biggest difference is the `BIRD_PROTOCOLS` arg which allow to define which protocols to use.
You can use `all` as a default, but in this case alpha-released protocols like `bmp` won't be compiled.

0 comments on commit b2ac3ef

Please sign in to comment.