forked from polycube-network/polycube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (35 loc) · 1.78 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
# syntax = tonistiigi/dockerfile:runmount20180618 # enables --mount option for run
FROM polycubebot/base_image:latest
ARG DEFAULT_MODE=default
ENV MODE=$DEFAULT_MODE
RUN echo "The mode is $MODE"
RUN rm -rf /tmp/polycube
RUN --mount=target=/polycube cp -r /polycube /tmp/polycube && \
cd /tmp/polycube && \
SUDO="" USER="root" WORKDIR="/tmp/dev" ./scripts/install.sh $MODE && \
# install pcn-kubernetes only components
if [ "$MODE" = "pcn-k8s" ] ; then \
cd /tmp && mkdir -p tmp && cd tmp && \
curl -sS -L https://storage.googleapis.com/kubernetes-release/network-plugins/cni-0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff.tar.gz -o cni.tar.gz && \
tar -xvf cni.tar.gz && \
mkdir /cni && \
cp bin/loopback /cni && \
cd /tmp/polycube/src/components/k8s/cni/polycube && \
GOOS=linux go build -o /opt/cni/bin/polycube . && \
cd /tmp/polycube/src/components/k8s/cni/conf && \
GOOS=linux go build -o /cni-conf . && \
cd /tmp/polycube/src/components/k8s/pcn_k8s/ && \
GOOS=linux go build -o /pcn_k8s . ; \
fi && \
apt-get purge --auto-remove -y git bison cmake flex \
libllvm5.0 llvm-5.0-dev libclang-5.0-dev uuid-dev autoconf software-properties-common golang-go \
libtool curl && \
apt-get clean && \
rm -fr /root /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/local/go/*
# TODO: which other apt-get packages can be removed?
ADD src/components/k8s/cni/cni-install.sh /cni-install.sh
ADD src/components/k8s/cni/cni-uninstall.sh /cni-uninstall.sh
ADD src/components/k8s/pcn_k8s/cleanup.sh /cleanup.sh
ADD src/components/k8s/pcn_k8s/init.sh /init.sh
# by running nsenter --mount=/host/proc/1/ns/mnt polycubed, the daemon has a complete view of the namespaces of the host and it is able to manipulate them (needed for shadow services)
CMD ["nsenter","--mount=/host/proc/1/ns/mnt","polycubed"]