-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
150 lines (127 loc) · 3.64 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
ARG BUILDER_BASE_IMG
ARG RUST_BASE_IMG
FROM $BUILDER_BASE_IMG as builder
ARG DEBUG=false
ARG DPDK_VERSION
ARG DPDK_PATH=http://fast.dpdk.org/rel
ARG DPDK_TARGET=/usr/local/src/dpdk-stable-${DPDK_VERSION}
ARG DPDK_MACHINE=corei7
ARG DPDK_TUNE_TYPE=corei7-avx
RUN apt-get update \
&& apt-get install -y \
build-essential \
libnuma-dev \
libpcap-dev \
linux-headers-$(uname -r) \
python3-setuptools \
python3-pip \
wget \
&& pip3 install \
meson \
ninja \
wheel \
&& wget ${DPDK_PATH}/dpdk-${DPDK_VERSION}.tar.gz -O - | tar xz -C /usr/local/src
WORKDIR ${DPDK_TARGET}
RUN meson build \
&& cd build \
&& if [ "$DEBUG" = "true" ]; then meson configure -Dbuildtype=debug; fi \
&& meson configure -Dmachine=${DPDK_MACHINE} \
&& meson configure -Dc_args=-mtune=${DPDK_TUNE_TYPE} \
&& ninja \
&& ninja install \
&& rm -rf ${DPDK_TARGET}/build /usr/local/bin/dpdk-test \
/usr/local/bin/dpdk-test-* /usr/local/bin/meson /usr/local/bin/ninja
##
## dpdk
##
FROM debian:buster-slim as dpdk
LABEL maintainer="Capsule Developers <capsule-dev@googlegroups.com>"
COPY --from=builder /usr/local/lib/x86_64-linux-gnu /usr/local/lib/x86_64-linux-gnu
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libnuma1 \
libpcap0.8 \
&& apt-get autoremove -y \
&& apt-get clean \
&& ldconfig \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives
##
## dpdk-devbind utility
##
FROM debian:buster-slim as dpdk-devbind
LABEL maintainer="Capsule Developers <capsule-dev@googlegroups.com>"
COPY --from=builder /usr/local/bin/dpdk-devbind.py /usr/local/bin/dpdk-devbind.py
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
iproute2 \
pciutils \
python \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives
##
## dpdk-mod utility
##
FROM debian:buster-slim as dpdk-mod
LABEL maintainer="Capsule Developers <capsule-dev@googlegroups.com>"
COPY --from=builder /lib/modules /lib/modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
kmod \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives
##
## capsule-sandbox for development
##
FROM $RUST_BASE_IMG as sandbox
LABEL maintainer="Capsule Developers <capsule-dev@googlegroups.com>"
ARG DPDK_VERSION
ARG DPDK_TARGET=/usr/local/src/dpdk-stable-${DPDK_VERSION}
ARG RR_VERSION
ENV CARGO_INCREMENTAL=0
ENV RUST_BACKTRACE=1
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/lib/x86_64-linux-gnu /usr/local/lib/x86_64-linux-gnu
COPY --from=builder /usr/local/include /usr/local/include
COPY --from=builder ${DPDK_TARGET} ${DPDK_TARGET}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang \
gdb \
gnuplot \
iproute2 \
kmod \
libclang-dev \
libnuma-dev \
libpcap-dev \
libssl-dev \
llvm-dev \
pciutils \
pkg-config \
python-pyelftools \
python3-setuptools \
python3-pip \
tcpdump \
wget \
&& ldconfig \
&& pip3 install \
meson \
ninja \
wheel \
&& rustup component add \
clippy \
rust-docs \
rustfmt \
rust-src \
&& cargo install cargo-watch \
&& cargo install cargo-expand \
&& wget -P /tmp https://github.com/mozilla/rr/releases/download/${RR_VERSION}/rr-${RR_VERSION}-Linux-$(uname -m).deb \
&& dpkg -i /tmp/rr-${RR_VERSION}-Linux-$(uname -m).deb \
&& apt-get purge -y \
wget \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf .cargo/registry /var/lib/apt/lists/* /var/cache/apt/archives /tmp/*