-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-ubuntu-18-04
111 lines (96 loc) · 2.74 KB
/
Dockerfile-ubuntu-18-04
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
FROM ubuntu:18.04
#------------------------------------------------------------------------------
# Docker build setup
#------------------------------------------------------------------------------
# Configure apt
ENV DEBIAN_FRONTEND noninteractive
# Clone and compile in /opt
WORKDIR /opt
# Make number of jobs used for compilation configurable - allow separate
# configuration for P4C compilation as it needs a lot of RAM
ARG JOBS=1
ARG P4C_JOBS=$JOBS
# P4C recommends v3.6.1
ARG PROTOBUF_COMMIT="v3.6.1"
#------------------------------------------------------------------------------
# Dependencies
#------------------------------------------------------------------------------
RUN apt-get update && apt-get -y \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold" \
upgrade
RUN apt-get -y install --no-install-recommends --fix-missing \
automake \
bison \
cmake \
flex \
g++ \
git \
libboost-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-iostreams-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-test-dev \
libboost-thread-dev \
libevent-dev \
libffi-dev \
libfl-dev \
libgc-dev \
libgmp-dev \
libjudy-dev \
libpcap-dev \
libssl1.0-dev \
libtool \
llvm \
pkg-config \
python-dev \
python-pip \
python-setuptools \
python-wheel \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
sudo \
tcpdump \
wget
RUN pip3 install \
scapy \
ipaddr \
ply
#------------------------------------------------------------------------------
# Protobuf
#------------------------------------------------------------------------------
RUN git clone https://github.com/google/protobuf.git && \
cd protobuf && \
git checkout ${PROTOBUF_COMMIT} && \
export CFLAGS="-Os" && \
export CXXFLAGS="-Os" && \
export LDFLAGS="-Wl,-s" && \
./autogen.sh && \
./configure --prefix=/usr && \
make -j${JOBS} && \
make install && \
ldconfig && \
unset CFLAGS CXXFLAGS LDFLAGS && \
cd python && \
python3 setup.py install
#------------------------------------------------------------------------------
# P4C
#------------------------------------------------------------------------------
COPY . qp4c/
RUN cd qp4c && \
mkdir -p build && \
cd build && \
cmake .. && \
make -j${P4C_JOBS} && \
make install && \
ldconfig
#------------------------------------------------------------------------------
# Change WORKDIR to /workspace and set p4c as entrypoint
#------------------------------------------------------------------------------
RUN mkdir /workspace
WORKDIR /workspace
ENTRYPOINT ["/usr/local/bin/p4c"]