-
Notifications
You must be signed in to change notification settings - Fork 106
/
Dockerfile
156 lines (135 loc) · 4.57 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020-present Open Networking Foundation
# Copyright 2019-present Intel Corporation
# Stage bess-build: fetch BESS dependencies & pre-reqs
FROM registry.aetherproject.org/sdcore/bess_build:latest AS bess-build
ARG CPU=native
ARG BESS_COMMIT=master
ENV PLUGINS_DIR=plugins
ARG MAKEFLAGS
ENV PKG_CONFIG_PATH=/usr/lib64/pkgconfig
RUN apt-get update && apt-get install -y \
--no-install-recommends \
git \
ca-certificates \
libbpf0 \
libelf-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# BESS pre-reqs
WORKDIR /bess
RUN git clone https://github.com/omec-project/bess.git . && \
git checkout ${BESS_COMMIT} && \
cp -a protobuf /protobuf
# Build DPDK
RUN ./build.py dpdk
# Plugins: SequentialUpdate
RUN mkdir -p plugins && \
mv sample_plugin plugins
## Network Token
ARG ENABLE_NTF
ARG NTF_COMMIT=master
COPY scripts/install_ntf.sh .
RUN ./install_ntf.sh
# Build and copy artifacts
RUN PLUGINS=$(find "$PLUGINS_DIR" -mindepth 1 -maxdepth 1 -type d) && \
CMD="./build.py bess" && \
for PLUGIN in $PLUGINS; do \
CMD="$CMD --plugin \"$PLUGIN\""; \
done && \
eval "$CMD" && \
cp bin/bessd /bin && \
mkdir -p /bin/modules && \
cp core/modules/*.so /bin/modules && \
mkdir -p /opt/bess && \
cp -r bessctl pybess /opt/bess && \
cp -r core/pb /pb
# Stage bess: creates the runtime image of BESS
FROM ubuntu:24.04 AS bess
WORKDIR /
COPY requirements.txt .
RUN apt-get update && apt-get install -y \
--no-install-recommends \
python3-pip \
libgraph-easy-perl \
iproute2 \
iptables \
iputils-ping \
tcpdump && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir --break-system-packages -r requirements.txt
COPY --from=bess-build /opt/bess /opt/bess
COPY --from=bess-build /bin/bessd /bin/bessd
COPY --from=bess-build /bin/modules /bin/modules
COPY conf /opt/bess/bessctl/conf
RUN ln -s /opt/bess/bessctl/bessctl /bin
# CNDP: Install dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
--no-install-recommends \
build-essential \
ethtool \
libbsd0 \
libelf1 \
libgflags2.2 \
libjson-c[45] \
libnl-3-200 \
libnl-cli-3-200 \
libnuma1 \
libpcap0.8 \
pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=bess-build /usr/bin/cndpfwd /usr/bin/
COPY --from=bess-build /usr/local/lib/x86_64-linux-gnu/*.so /usr/local/lib/x86_64-linux-gnu/
COPY --from=bess-build /usr/local/lib/x86_64-linux-gnu/*.a /usr/local/lib/x86_64-linux-gnu/
COPY --from=bess-build /usr/lib/libxdp* /usr/lib/
COPY --from=bess-build /usr/lib/x86_64-linux-gnu/libjson-c.so* /lib/x86_64-linux-gnu/
COPY --from=bess-build /usr/lib/x86_64-linux-gnu/libbpf.so* /usr/lib/x86_64-linux-gnu/
ENV PYTHONPATH="/opt/bess"
WORKDIR /opt/bess/bessctl
ENTRYPOINT ["bessd", "-f"]
# Stage build bess golang pb
FROM golang:1.23.1 AS protoc-gen
RUN go install github.com/golang/protobuf/protoc-gen-go@latest
FROM bess-build AS go-pb
COPY --from=protoc-gen /go/bin/protoc-gen-go /bin
RUN mkdir /bess_pb && \
protoc -I /usr/include -I /protobuf/ \
/protobuf/*.proto /protobuf/ports/*.proto \
--go_opt=paths=source_relative --go_out=plugins=grpc:/bess_pb
FROM bess-build AS py-pb
RUN pip install --no-cache-dir grpcio-tools==1.26
RUN mkdir /bess_pb && \
python3 -m grpc_tools.protoc -I /usr/include -I /protobuf/ \
/protobuf/*.proto /protobuf/ports/*.proto \
--python_out=plugins=grpc:/bess_pb \
--grpc_python_out=/bess_pb
FROM golang:1.23.1 AS pfcpiface-build
ARG GOFLAGS
WORKDIR /pfcpiface
COPY go.mod /pfcpiface/go.mod
COPY go.sum /pfcpiface/go.sum
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN if echo "$GOFLAGS" | grep -Eq "-mod=vendor"; then go mod download; fi
COPY . /pfcpiface
RUN CGO_ENABLED=0 go build $GOFLAGS -o /bin/pfcpiface ./cmd/pfcpiface
# Stage pfcpiface: runtime image of pfcpiface toward SMF/SPGW-C
FROM alpine:3.20.3 AS pfcpiface
COPY conf /opt/bess/bessctl/conf
COPY --from=pfcpiface-build /bin/pfcpiface /bin
ENTRYPOINT [ "/bin/pfcpiface" ]
# Stage pb: dummy stage for collecting protobufs
FROM scratch AS pb
COPY --from=bess-build /bess/protobuf /protobuf
COPY --from=go-pb /bess_pb /bess_pb
# Stage ptf-pb: dummy stage for collecting python protobufs
FROM scratch AS ptf-pb
COPY --from=bess-build /bess/protobuf /protobuf
COPY --from=py-pb /bess_pb /bess_pb
# Stage binaries: dummy stage for collecting artifacts
FROM scratch AS artifacts
COPY --from=bess /bin/bessd /
COPY --from=pfcpiface /bin/pfcpiface /
COPY --from=bess-build /bess /bess