-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdas-schiff-cra-frr.Dockerfile
More file actions
79 lines (66 loc) · 2.56 KB
/
Copy pathdas-schiff-cra-frr.Dockerfile
File metadata and controls
79 lines (66 loc) · 2.56 KB
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
# Build the manager binary
ARG GO_VERSION=1.25
FROM docker.io/library/golang:${GO_VERSION}-alpine AS builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Install BPF build tools
RUN apk add llvm clang linux-headers libbpf-dev musl-dev
# Copy the go source
COPY cmd/frr-cra/main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/
# Compile BPF program from source
COPY bpf/ bpf/
RUN cd pkg/bpf/ && go generate
# Build
ARG ldflags
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "${ldflags}" -a -o frr-cra main.go
FROM docker.io/library/ubuntu:25.10
ENV FRRVER="frr-10.6"
ARG DEBIAN_FRONTEND=noninteractive
# Install: dependencies, clean: apt cache, remove dir: cache, man, doc, change mod time of cache dir.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
ca-certificates \
curl \
systemd \
netplan.io \
prometheus-node-exporter \
iputils-ping \
mtr-tiny \
&& apt-get clean \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& rm -rf /var/lib/apt/lists/* \
&& touch -d "2 hours ago" /var/lib/apt/lists
RUN curl -fsSL https://deb.frrouting.org/frr/keys.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/frr.gpg && \
echo "deb https://deb.frrouting.org/frr noble $FRRVER" | tee -a /etc/apt/sources.list.d/frr.list
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
frr \
frr-pythontools \
&& apt-get clean \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& rm -rf /var/lib/apt/lists/* \
&& touch -d "2 hours ago" /var/lib/apt/lists
RUN rm /usr/bin/udevadm && ln -s /usr/bin/true /usr/bin/udevadm
COPY ./docker/frr-cra.service /lib/systemd/system/
COPY ./docker/fix-vrf-rules.service /lib/systemd/system/
COPY ./docker/daemons /etc/frr/daemons
COPY ./docker/networkd.conf /etc/systemd/networkd.conf.d/cra.conf
COPY ./docker/10-cra.conf /etc/sysctl.d/10-cra.conf
COPY --from=builder /workspace/frr-cra /usr/local/bin/frr-cra
COPY ./docker/frr-cra.env /etc/default/frr-cra
COPY ./docker/prometheus-node-exporter.env /etc/default/prometheus-node-exporter
COPY ./docker/hosts /etc/hosts
RUN systemctl enable frr-cra.service
RUN systemctl enable fix-vrf-rules.service
RUN systemctl enable prometheus-node-exporter.service
VOLUME ["/sys/fs/cgroup", "/tmp", "/run"]
CMD ["/sbin/init"]