-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.bmv2
70 lines (64 loc) · 2.41 KB
/
Dockerfile.bmv2
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
FROM p4lang/behavioral-model:no-pi
LABEL maintainer="Antonin Bas <antonin@barefootnetworks.com>"
LABEL description="This Docker image includes all of the PI artifacts, \
including the Thrift-based PI implementation for the bmv2 backend. It is \
currently used to run CI tests."
# Default to using 2 make jobs, which is a good default for CI. If you're
# building locally or you know there are more cores available, you may want to
# override this.
ARG MAKEFLAGS=-j2
# Select the type of image we're building. Use `build` for a normal build, which
# is optimized for image size. Use `test` if this image will be used for
# testing; in this case, the source code and build-only dependencies will not be
# removed from the image.
ARG IMAGE_TYPE=build
# Select the compiler to use. GCC 5 is available as 'gcc'/'g++'. GCC 6 is
# available as 'gcc-6'/'g++-6'. Clang 3.8 is available as
# 'clang-3.8'/'clang++-3.8'.
ARG CC=gcc
ARG CXX=g++
ENV PI_DEPS automake \
build-essential \
clang-3.8 \
clang-format-3.8 \
g++ \
g++-6 \
libboost-dev \
libboost-system-dev \
libboost-thread-dev \
libtool \
libtool-bin \
pkg-config \
libjudy-dev \
libreadline-dev \
libpcap-dev \
libmicrohttpd-dev \
doxygen \
valgrind
ENV PI_RUNTIME_DEPS libboost-system1.58.0 \
libboost-thread1.58.0 \
libjudydebian1 \
libpcap0.8 \
python
COPY proto/sysrepo/docker_entry_point.sh /docker_entry_point.sh
COPY . /PI/
WORKDIR /PI/
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get install -y --no-install-recommends $PI_DEPS $PI_RUNTIME_DEPS && \
./autogen.sh && \
./configure --with-bmv2 --with-proto --with-sysrepo && \
./proto/sysrepo/install_yangs.sh && \
make && \
make install-strip && \
(test "$IMAGE_TYPE" = "build" && \
apt-get purge -y $PI_DEPS && \
apt-get autoremove --purge -y && \
rm -rf /PI /var/cache/apt/* /var/lib/apt/lists/* && \
echo 'Build image ready') || \
(test "$IMAGE_TYPE" = "test" && \
echo 'Test image ready')
# start sysrepo daemon (sysrepod)
ENTRYPOINT ["/docker_entry_point.sh"]