-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
139 lines (131 loc) · 3.69 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
FROM debian:12
# Install commonly needed tools.
# - Networking tools:
# - curl
# - iproute2
# - iputils-ping
# - iputils-tracepath
# - tcpdump
# - Debugging tools:
# - gdb
# - tmux
# - valgrind
# - vim
# - Build dependencies (libyang):
# - build-essential
# - cmake
# - libpcre2-dev
# - Build dependencies (frr):
# - bison
# - flex
# - git (used by build system to generate code with git sha)
# - install-info
# - libcap-dev
# - libc-ares-dev
# - libelf-dev
# - libgrpc++-dev (`--enable-grpc`: provides gRPC headers)
# - libjson-c-dev
# - libprotobuf-c-dev
# - libreadline-dev
# - libsnmp-dev (`--enable-snmp=agentx`)
# - libtool (pulls `autoconf` and `automake`)
# - libunwind-dev (for better back traces)
# - pkg-config (for configure and libyang build)
# - protobuf-c-compiler
# - protobuf-compiler-grpc (`--enable-grpc`: provides `protoc-gen-grpc`)
# - python3-dev
# - python3-pytest (topotests / make check)
# - python3-sphinx (`--enable-doc`)
# - sudo (topotests uses for `--cli-on-error`)
# - texinfo
# - Topotest dependencies:
# - net-tools
# - python3-exabgp
# - python3-pytest-xdist
# - python3-scapy
# - snmp
# - snmpd
# - snmp-mibs-downloader
ARG DEBIAN_FRONTEND=noninteractive
RUN sed -i 's/^Components: main$/& contrib non-free/' /etc/apt/sources.list.d/debian.sources \
&& apt update && apt install -y \
bison \
build-essential \
cmake \
curl \
flex \
gdb \
git \
install-info \
iproute2 \
iputils-ping \
iputils-tracepath \
libcap-dev \
libc-ares-dev \
libelf-dev \
libgrpc++-dev \
libjson-c-dev \
libpcre2-dev \
libprotobuf-c-dev \
libreadline-dev \
libsnmp-dev \
libtool \
libunwind-dev \
net-tools \
pkg-config \
protobuf-c-compiler \
protobuf-compiler-grpc \
python3-dev \
python3-exabgp \
python3-pytest \
python3-pytest-xdist \
python3-scapy \
python3-sphinx \
snmp \
snmpd \
snmp-mibs-downloader \
sudo \
tcpdump \
texinfo \
tmux \
valgrind \
vim \
;
# Patch required SNMP MIB for topotest
RUN curl -o /usr/share/snmp/mibs/ietf/SNMPv2-PDU \
https://raw.githubusercontent.com/FRRouting/frr-mibs/main/ietf/SNMPv2-PDU
# Configure system for FRR privilege drop
RUN groupadd -r -g 92 frr && \
groupadd -r -g 85 frrvty && \
adduser --system --ingroup frr --home /var/run/frr \
--gecos "FRR suite" --shell /sbin/nologin frr && \
usermod -a -G frrvty frr
# Build and install libyang
WORKDIR /root
ARG LIBYANG_VERSION='2.1.128'
RUN curl -L "https://github.com/CESNET/libyang/archive/refs/tags/v${LIBYANG_VERSION}.tar.gz" \
| tar -xvzf - \
&& cd /root/libyang-${LIBYANG_VERSION} \
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -B build \
&& make -C build -j $(nproc) install
# Install topotest socat version
RUN apt install -y yodl \
&& git clone https://github.com/opensourcerouting/socat.git \
&& cd /root/socat \
&& echo "\"opensourcerouting/socat@`git rev-parse --short HEAD`\"" > VERSION \
&& autoconf \
&& ./configure \
&& make -j $(nproc) \
&& make install \
&& cd /root \
&& rm -rf socat \
&& apt purge -y yodl \
;
# Create exabgp user for topotest
RUN useradd -r -d /var/run/exabgp -s /bin/false exabgp
# Set python3 as default (required by `frr-reload.py` and `topotests`)
RUN ln -sv /usr/bin/python3 /usr/bin/python
COPY frr-start /usr/sbin/frr-start
COPY frr-build /usr/sbin/frr-build
COPY container-init /usr/sbin/container-init
ENTRYPOINT [ "/usr/sbin/frr-start" ]