This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
DockerfileM5
146 lines (130 loc) · 6.25 KB
/
DockerfileM5
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# BSD License
#
# Copyright (C) 2017-2018 Baidu, Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Baidu, Inc., nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Copyright 2019 Supercomputing Systems AG
FROM ubuntu:18.04
LABEL MAINTAINER="Yu Ding"
# Intel SGX files
ENV sdk_bin https://download.01.org/intel-sgx/linux-2.5/ubuntu18.04-server/sgx_linux_x64_sdk_2.5.100.49891.bin
ENV psw_deb https://download.01.org/intel-sgx/linux-2.5/ubuntu18.04-server/libsgx-enclave-common_2.5.101.50123-bionic1_amd64.deb
ENV psw_dev_deb https://download.01.org/intel-sgx/linux-2.5/ubuntu18.04-server/libsgx-enclave-common-dev_2.5.101.50123-bionic1_amd64.deb
ENV psw_dbgsym_deb https://download.01.org/intel-sgx/linux-2.5/ubuntu18.04-server/libsgx-enclave-common-dbgsym_2.5.101.50123-bionic1_amd64.ddeb
# substraTEE files
ENV substratee_node_release M5.2
ENV substratee_worker_release M5.2
ENV substratee_node https://github.com/scs/substraTEE-node/archive/${substratee_node_release}.zip
ENV substratee_worker https://github.com/scs/substraTEE-worker/archive/${substratee_worker_release}.zip
ENV DEBIAN_FRONTEND=noninteractive
ENV TERM xterm
SHELL ["/bin/bash", "-c"]
# prepare the linux system
RUN apt-get update && \
apt-get install -y --no-install-recommends\
build-essential ocaml ocamlbuild automake autoconf \
libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler \
libprotobuf-dev kmod vim curl git-core libprotobuf-c0-dev \
libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev \
alien uuid-dev libxml2-dev cmake pkg-config expect systemd-sysv gdb unzip \
clang libclang-dev rsync ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/*
# install the Intel SGX PSW and SDK
RUN mkdir /root/sgx && \
mkdir /etc/init && \
wget -O /root/sgx/psw.deb ${psw_deb} && \
wget -O /root/sgx/psw_dev.deb ${psw_dev_deb} && \
wget -O /root/sgx/psw_dbgsym.deb ${psw_dbgsym_deb} && \
wget -O /root/sgx/sdk.bin ${sdk_bin} && \
cd /root/sgx && \
dpkg -i /root/sgx/psw.deb && \
dpkg -i /root/sgx/psw_dev.deb && \
dpkg -i /root/sgx/psw_dbgsym.deb && \
chmod +x /root/sgx/sdk.bin && \
echo -e 'no\n/opt' | /root/sgx/sdk.bin && \
echo 'source /opt/sgxsdk/environment' >> /root/.bashrc && \
rm -rf /root/sgx/*
# installing rust-sgx-sdk
ENV rust_toolchain nightly-2019-11-17
RUN wget 'https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init' -O /root/rustup-init && \
chmod +x /root/rustup-init && \
echo '1' | /root/rustup-init --default-toolchain ${rust_toolchain} && \
echo 'source /root/.cargo/env' >> /root/.bashrc && \
/root/.cargo/bin/rustup component add rust-src && \
HI=$(/root/.cargo/bin/rustup which rustc) && HI=${HI%/bin/rustc} && export TOOLCHAIN_DIR=$HI && echo TOOLCHAIN_DIR=$TOOLCHAIN_DIR && \
rm -rf $TOOLCHAIN_DIR/share/doc && \
rm -rf $TOOLCHAIN_DIR/share/man && \
rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git
# /root/.cargo/bin/cargo install xargo && \
# downloading and extracting the substraTEE components
RUN mkdir /substraTEE && \
wget -O /substraTEE/substraTEE-node.zip ${substratee_node} && \
wget -O /substraTEE/substraTEE-worker.zip ${substratee_worker} && \
cd /substraTEE && \
unzip substraTEE-node.zip && \
mv substraTEE-node-${substratee_node_release} substraTEE-node && \
unzip substraTEE-worker.zip && \
mv substraTEE-worker-${substratee_worker_release} substraTEE-worker && \
rm substraTEE-*.zip
# init the rust environment
ENV CI_PROJECT_NAME test
RUN source /opt/sgxsdk/environment && \
source /root/.cargo/env && \
/substraTEE/substraTEE-node/scripts/init.sh
RUN /root/.cargo/bin/rustup show
# build the substraTEE-node
RUN source /opt/sgxsdk/environment && \
source /root/.cargo/env && \
cd /substraTEE/substraTEE-node && \
cargo build --release && \
rm -rf target/release/deps && \
rm -rf target/release/wbuild && \
rm -rf target/release/build && \
rm -rf target/release/wbuild-runner
# build the substraTEE-worker
RUN source /opt/sgxsdk/environment && \
source /root/.cargo/env && \
cd /substraTEE/substraTEE-worker && \
make && \
rm -rf target/release/deps && \
rm -rf target/release/wbuild && \
rm -rf target/release/build && \
rm -rf target/release/wbuild-runner && \
rm -rf enclave/target/release/deps && \
rm -rf enclave/target/release/build
# install ipfs
RUN mkdir /ipfs && \
cd ipfs && \
wget -O go-ipfs.tar.gz https://dist.ipfs.io/go-ipfs/v0.4.21/go-ipfs_v0.4.21_linux-amd64.tar.gz && \
tar xvfz go-ipfs.tar.gz && \
cd go-ipfs && \
./install.sh
# copy the shell scripts to the docker to launch to node and the workers
COPY scriptsM5/* /substraTEE/
WORKDIR /substraTEE