-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
179 lines (156 loc) · 5.56 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Build image with DPDK, etc.
FROM --platform=${TARGETPLATFORM} debian:12-slim AS builder
ARG TARGETARCH
ARG DPDK_VER=23.11
ARG DPSERVICE_FEATURES=""
WORKDIR /workspace
# Install prerequisite packages
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ON \
libibverbs-dev \
libmnl-dev \
libnuma-dev \
numactl \
libnuma1 \
unzip \
make \
gcc \
g++ \
clang \
git \
ethtool \
pciutils \
procps \
ninja-build \
meson \
python3-pyelftools \
iproute2 \
libuuid1 \
uuid-dev \
net-tools \
xz-utils \
tar \
findutils \
jq \
curl \
build-essential \
pkg-config \
protobuf-compiler-grpc \
libgrpc++1.51 \
libgrpc++-dev \
libpcap0.8-dev
# Need at least Golang 1.20 which is not part of Debian-12 stable
RUN curl -Ls https://golang.org/dl/go1.20.14.linux-${TARGETARCH}.tar.gz | tar xz -C /usr/local/
ENV PATH="${PATH}:/usr/local/go/bin"
# Download DPDK
ADD http://fast.dpdk.org/rel/dpdk-${DPDK_VER}.tar.xz dpdk.tar.xz
RUN tar -xJf dpdk.tar.xz
ENV DPDK_DIR=/workspace/dpdk-${DPDK_VER}
# Copy DPDK patches
COPY hack/*.patch hack/
RUN cd $DPDK_DIR \
&& patch -p1 < ../hack/dpdk_23_11_log.patch \
&& patch -p1 < ../hack/dpdk_23_11_telemetry_key.patch \
&& patch -p1 < ../hack/dpdk_23_11_ethdev_conversion.patch
# Compile DPDK
RUN cd $DPDK_DIR && meson setup -Dmax_ethports=132 -Dplatform=generic -Ddisable_drivers=common/dpaax,\
common/cpt,common/iavf,\
common/octeontx,common/octeontx2,common/cnxk,common/qat,regex/octeontx2,net/cnxk,dma/cnxk,\
common/sfc_efx,common/auxiliary,common/dpaa,common/fslmc,common/ifpga,common/vdev,common/vmbus,\
mempool/octeontx,mempool/octeontx2,baseband/*,event/*,net/ark,net/atlantic,net/avp,net/axgbe,\
net/bnxt,net/bond,net/cxgbe,net/dpaa,net/dpaa2,net/e1000,net/ena,net/enetc,net/enetfec,net/enic,\
net/failsafe,net/fm10k,net/hinic,net/hns3,net/i40e,net/iavf,net/ice,net/igc,net/ionic,net/ipn3ke,\
net/ixgbe,net/liquidio,net/memif,net/netsvs,net/nfp,net/ngbe,net/null,net/octeontx,net/octeontx2,\
net/octeontx_ep,net/pcap,net/pfe,net/qede,net/sfc,net/softnic,net/thunderx,net/txgbe,\
net/vdev_ntsvc,net/vhost,net/virtio,net/vmxnet3,net/bnx2x,net/netsvc,net/vdev_netsvc,\
crypto/dpaa_sec,crypto/bcmfs,crypto/caam_jr,crypto/cnxk,dpaa_sec,crypto/dpaa2_sec,crypto/nitrox,\
crypto/null,crypto/octeontx,crypto/octeontx2,crypto/scheduler,crypto/virtio -Ddisable_libs=power,\
vhost,gpudev build -Ddisable_apps="*" -Dtests=false
RUN cd $DPDK_DIR/build && ninja
RUN cd $DPDK_DIR/build && ninja install
# Prepare tools and sources
COPY meson.build meson.build
COPY meson_options.txt meson_options.txt
COPY hack/* hack/
COPY proto/ proto/
COPY go/ go/
COPY cli/ cli/
COPY tools/ tools/
COPY test/local/ test/
COPY src/ src/
COPY include/ include/
# Needed for version extraction by meson
COPY .git/ .git/
# Compile dpservice itself
RUN meson setup build -Dbuild_dpservice_cli=true $DPSERVICE_FEATURES && ninja -C build
# Extended build image for test-image
FROM builder AS testbuilder
ARG DPSERVICE_FEATURES=""
RUN meson setup release_build $DPSERVICE_FEATURES --buildtype=release && ninja -C release_build
RUN CC=clang CXX=clang++ meson setup clang_build $DPSERVICE_FEATURES && ninja -C clang_build
RUN meson setup xtratest_build $DPSERVICE_FEATURES -Denable_tests=true && ninja -C xtratest_build
RUN meson setup pf1_proxy_build $DPSERVICE_FEATURES -Denable_pf1_proxy=true && ninja -C pf1_proxy_build
# Test-image to run pytest
FROM debian:12-slim AS tester
RUN apt-get update && apt-get install -y --no-install-recommends ON \
libibverbs-dev \
numactl \
libnuma1 \
pciutils \
procps \
libuuid1 \
libgrpc++1.51 \
libpcap0.8-dev \
iproute2 \
udev \
gawk \
python3-pytest \
python3-scapy \
&& apt-get purge g++-12 ipython3 -y \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# some packages are for some reason part of python3-scapy installation:
# g++-12 with 900MB installed size
# ipython3 with 264MB installed size
WORKDIR /
COPY --from=testbuilder /workspace/test ./test
COPY --from=testbuilder /workspace/build/src/dpservice-bin ./build/src/dpservice-bin
COPY --from=testbuilder /workspace/build/cli/dpservice-cli/dpservice-cli ./build/cli/dpservice-cli/dpservice-cli
COPY --from=testbuilder /workspace/build/cli/dpservice-exporter/dpservice-exporter ./build/cli/dpservice-exporter/dpservice-exporter
COPY --from=testbuilder /workspace/xtratest_build/src/dpservice-bin ./xtratest_build/src/dpservice-bin
COPY --from=testbuilder /workspace/build/cli/dpservice-cli/dpservice-cli ./xtratest_build/cli/dpservice-cli/dpservice-cli
COPY --from=testbuilder /workspace/build/cli/dpservice-exporter/dpservice-exporter ./xtratest_build/cli/dpservice-exporter/dpservice-exporter
COPY --from=testbuilder /usr/local/lib /usr/local/lib
RUN ldconfig
WORKDIR /test
ENV PYTHONUNBUFFERED=1
ENTRYPOINT ["./runtest.py", "../build", "../xtratest_build"]
# Deployed pod image itself
FROM debian:12-slim AS production
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ON \
libibverbs-dev \
numactl \
libnuma1 \
pciutils \
procps \
libuuid1 \
libgrpc++1.51 \
libpcap0.8-dev \
iproute2 \
udev \
gawk \
bash-completion \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /
COPY --from=builder \
/workspace/build/src/dpservice-bin \
/workspace/build/tools/dump/dpservice-dump \
/workspace/build/cli/dpservice-cli/dpservice-cli \
/workspace/build/cli/dpservice-exporter/dpservice-exporter \
/workspace/hack/prepare.sh \
/usr/local/bin/
COPY --from=builder /usr/local/lib /usr/local/lib
RUN ldconfig
# Ensure bash-completion is working in operations
RUN echo 'PATH=${PATH}:/\nsource /etc/bash_completion\nsource <(dpservice-cli completion bash)' >> /root/.bashrc
ENTRYPOINT ["dpservice-bin"]