-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
109 lines (88 loc) · 3.82 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
101
102
103
104
105
106
107
108
FROM debian:bullseye
#Set Manufacturer Address incase of not using host.docker.internal
#ENV MANUFACTURER_ADDRESS="http://10.111.111.111:8039"
# install dependencies
RUN apt-get update && \
apt-get install -y git cmake gcc nano wget netcat iputils-ping && \
apt-get install -y build-essential python-setuptools clang-format dos2unix ruby build-essential &&\
apt-get install -y libglib2.0-dev libpcap-dev autoconf libtool libproxy-dev doxygen cmake libssl-dev mercurial
#install libcbor-dev if you get this error "fatal error: cbor.h: No such file or directory"
RUN apt-get install -y libcbor-dev
#install libtss2-dev if you get this error "fatal error: "tss2/tss2_esys.h: No such file or directory"
RUN apt-get install -y libtss2-dev
#install libmbedtls-dev if you get this error "fatal error: metee.h: No such file or directory"
RUN apt-get install -y libmbedtls-dev
#install for hawkbit-onboarding
RUN apt-get install -y inotify-tools swupdate
#install openssl and curl
RUN wget https://www.openssl.org/source/openssl-1.1.1s.tar.gz && \
tar -zxf openssl-1.1.1s.tar.gz && cd openssl-1.1.1s && \
./config && \
make && \
make test && \
mv /usr/bin/openssl ~/tmp && \
make install && \
ln -s /usr/local/bin/openssl /usr/bin/openssl && \
wget https://github.com/curl/curl/releases/download/curl-7_86_0/curl-7.86.0.tar.gz && \
tar -zxf curl-7.86.0.tar.gz && cd curl-7.86.0 && \
./configure --with-openssl --enable-versioned-symbols && \
make -j$(nproc) && \
make install
#install safestring library
RUN git clone https://github.com/intel/safestringlib.git && \
export SAFESTRING_ROOT=./safestringlib && \
cd ${SAFESTRING_ROOT} && \
mkdir obj && \
make && \
export SAFESTRING_ROOT=./safestringlib
#install Tinycbor library
RUN git clone https://github.com/intel/tinycbor.git --branch v0.5.3 && \
export TINYCBOR_ROOT=./tinycbor && \
cd ${TINYCBOR_ROOT} && \
make && \
export TINYCBOR_ROOT=./tinycbor
#install METEE library
RUN git clone https://github.com/intel/metee.git && \
export METEE_ROOT=./metee && \
cd ${METEE_ROOT} && \
cmake . && \
make -j$(nproc) && \
make install && \
export METEE_ROOT=./metee
# Copy your script into the container
COPY generate_keys.sh /
# Make the script executable
RUN chmod +x /generate_keys.sh
# Add dummy certificate and a ecdsa384privkey
COPY hb-cert.crt /
#install xxd
RUN apt-get install -y vim-common
# clone the client sdk repo
RUN git clone --depth 1 https://github.com/Vishwasrao1/client-sdk-fidoiot.git
#Build linux-client
ENV BUILD="debug"
ENV HTTPPROXY="false"
ENV AES_MODE="gcm"
ENV DA="ecdsa384"
ENV LOG_LEVEL="6"
RUN cd client-sdk-fidoiot && \
export SAFESTRING_ROOT=/safestringlib && \
export TINYCBOR_ROOT=/tinycbor && \
export METEE_ROOT=/metee && \
#./build.sh && \
echo " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " && \
echo "${LOG_LEVEL}":"${DA}":"${BUILD}":"${AES_MODE}" && \
echo " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " && \
#Remove -DRESUSE=true at the time of production
cmake -DREUSE=true -DHTTPPROXY=${HTTPPROXY} -DBUILD=${BUILD} -DDA=${DA} -DAES_MODE=${AES_MODE} -DLOG_LEVEL=${LOG_LEVEL} -DOPTIMIZE=1 . && \
make -j$(nproc) && \
mkdir -p "/opt/fdo" && \
install "/client-sdk-fidoiot/build/linux-client" "/opt/fdo" && \
mkdir -p "/opt/fdo/data" && \
cp -r "/client-sdk-fidoiot/data/" "/opt/fdo/" && \
#echo -n "${MANUFACTURER_ADDRESS}" > /opt/fdo/data/manufacturer_addr.bin && \
# generate data backup
mkdir -p "/opt/fdo/data_bkp" && \
cp -r "/opt/fdo/data/" "/opt/fdo/data_bkp"
# Build the linux client first && generate ecdsa keys
CMD ["/bin/bash", "-c", "/generate_keys.sh & tail -f /dev/null"]