-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
56 lines (44 loc) · 1.6 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
#######################################
# #
# BUILDER #
# #
#######################################
FROM ubuntu:20.04 AS builder
# Setup APT
ENV DEBIAN_FRONTEND noninteractive
# Install build dependencies
RUN apt-get update \
&& apt-get install -y build-essential pkg-config cmake ccache libboost-dev libboost-program-options-dev libmosquitto-dev libjsoncpp-dev \
&& rm -rf /var/lib/apt/lists/*
#######################################
# #
# BUILD #
# #
#######################################
FROM builder AS build
# Setup ccache
# Source: https://stackoverflow.com/a/56833198
ENV CCACHE_DIR /ccache
# Add FlowEmu source
ADD CMakeLists.txt /flowemu/CMakeLists.txt
ADD src /flowemu/src
# Build FlowEmu
RUN --mount=type=cache,target=/ccache \
mkdir -p /flowemu/BUILD \
&& cd /flowemu/BUILD \
&& cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. \
&& make -j$(nproc)
#######################################
# #
# RUNTIME #
# #
#######################################
FROM ubuntu:20.04
# Setup APT
ENV DEBIAN_FRONTEND noninteractive
# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y libboost-program-options1.71.0 libmosquitto1 libjsoncpp1 iproute2 iputils-ping iperf \
&& rm -rf /var/lib/apt/lists/*
# Install FlowEmu
COPY --from=build /flowemu/BUILD/bin/* /usr/bin/