forked from igortern/bbf-wt451-polt-sim
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
100 lines (81 loc) · 2.48 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
# Dockerfile for obbaa-polt-simulator
ARG OBBAA_OLT_ADAPTER_VERSION="2.1"
# image to build the code
ARG FROM_TAG=20.04
FROM ubuntu:$FROM_TAG AS builder
ARG http_proxy
ARG https_proxy
ARG OBBAA_OLT_ADAPTER_VERSION
# install OS and perl packages
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --yes install \
automake \
ccache \
cmake \
cpanminus \
g++ \
gcc \
git \
libtool \
m4 \
make \
patch \
pkg-config \
wget \
xz-utils \
zip \
python3 \
python3-dev \
vim \
openssh-client \
&& cpanm \
FindBin \
&& apt-get clean
# set working directory
WORKDIR /opt/obbaa-polt-simulator
# copy pOLT simulator code
COPY . .
# build pOLT simulator (this installs to build/fs)
RUN echo "Building polt-simulator for OBBAA_OLT_ADAPTER_VERSION=$OBBAA_OLT_ADAPTER_VERSION .."; \
make OBBAA_DEVICE_ADAPTER_VERSION="$OBBAA_OLT_ADAPTER_VERSION" BUILD_TOP_DIR=/usr/local
# image to run the code
FROM ubuntu:$FROM_TAG
ARG PASSWD=root
ARG DEBUG
ARG http_proxy
ARG https_proxy
#Use pip options as workaround behind a proxy
#--trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
ARG PIP_OPTIONS
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --yes install \
openssh-client \
openssl \
python3 \
python3-pip \
&& if [ -n "$DEBUG" ] ; \
then DEBIAN_FRONTEND=noninteractive apt-get --yes install \
vim \
gdb \
wget \
net-tools \
iputils-ping \
tshark \
valgrind ; \
else : ; fi \
&& apt-get clean
ENV PYTHONIOENCODING="utf8"
# copy build/fs subdirs to /usr/local
COPY --from=builder /usr/local/fs/ /usr/local/
COPY certificates/ certificates/
COPY python_files/ requirements.txt python_files/
RUN ldconfig && echo root:$PASSWD | chpasswd
# generate RSA key pair
RUN mkdir -p /root/.ssh && \
openssl genrsa -out /root/.ssh/polt.pem && \
openssl req -new -x509 -sha256 -key /root/.ssh/polt.pem -out /root/.ssh/polt.cer -days 3650 -config certificates/request.conf
# Rest Api polt installations
RUN pip3 install $PIP_OPTIONS -r /python_files/requirements.txt
WORKDIR /usr/local
# copy the simulator's certificate and start netopeer2
ENTRYPOINT ["/usr/local/start_netconf_server.sh"]