github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/consensus/poet/sgx/Dockerfile-installed (about) 1 # Copyright 2018 Cargill Incorporated 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # docker build -f consensus/poet/sgx/Dockerfile-installed -t sawtooth-poet-sgx . 16 17 # -------------=== poet common build ===------------- 18 19 FROM ubuntu:xenial as poet-common-builder 20 21 ENV VERSION=AUTO_STRICT 22 23 RUN echo "deb http://repo.sawtooth.me/ubuntu/ci xenial universe" >> /etc/apt/sources.list \ 24 && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD \ 25 || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) \ 26 && apt-get update \ 27 && apt-get install -y -q --allow-downgrades \ 28 git \ 29 python3 \ 30 python3-grpcio-tools \ 31 python3-grpcio \ 32 python3-protobuf \ 33 python3-stdeb 34 35 COPY . /project 36 37 RUN /project/bin/protogen \ 38 && cd /project/consensus/poet/common/ \ 39 && if [ -d "debian" ]; then rm -rf debian; fi \ 40 && python3 setup.py clean --all \ 41 && python3 setup.py --command-packages=stdeb.command debianize \ 42 && if [ -d "packaging/ubuntu" ]; then cp -R packaging/ubuntu/* debian/; fi \ 43 && dpkg-buildpackage -b -rfakeroot -us -uc 44 45 # -------------=== ias_client build ===------------- 46 47 FROM ubuntu:xenial as ias-client-builder 48 49 ENV VERSION=AUTO_STRICT 50 51 RUN echo "deb http://repo.sawtooth.me/ubuntu/ci xenial universe" >> /etc/apt/sources.list \ 52 && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD \ 53 || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) \ 54 && apt-get update \ 55 && apt-get install -y -q --allow-downgrades \ 56 git \ 57 python3 \ 58 python3-requests \ 59 python3-stdeb 60 61 COPY . /project 62 63 RUN cd /project/utility/ias_client \ 64 && if [ -d "debian" ]; then rm -rf debian; fi \ 65 && python3 setup.py clean --all \ 66 && python3 setup.py --command-packages=stdeb.command debianize \ 67 && if [ -d "packaging/ubuntu" ]; then cp -R packaging/ubuntu/* debian/; fi \ 68 && dpkg-buildpackage -b -rfakeroot -us -uc 69 70 71 # -------------=== poet sgx builder ===------------- 72 73 FROM ubuntu:xenial as poet-sgx-builder 74 75 ENV VERSION=AUTO_STRICT 76 77 RUN echo "deb http://repo.sawtooth.me/ubuntu/ci xenial universe" >> /etc/apt/sources.list \ 78 && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD \ 79 || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) \ 80 && apt-get update \ 81 && apt-get install -y -q --allow-downgrades \ 82 build-essential \ 83 ca-certificates \ 84 cmake \ 85 dh-autoreconf \ 86 git \ 87 libcrypto++-dev \ 88 libjson-c-dev \ 89 make \ 90 python3-all-dev \ 91 python3-dev \ 92 python3-protobuf \ 93 python3-setuptools \ 94 python3-setuptools-scm=1.15.0-1 \ 95 python3-stdeb \ 96 python3-toml \ 97 software-properties-common \ 98 swig3.0 \ 99 unzip \ 100 wget \ 101 && apt-get clean \ 102 && rm -rf /var/lib/apt/lists/* 103 104 RUN ln -s /usr/bin/swig3.0 /usr/bin/swig 105 106 # Install SGX SDK for PoET 107 WORKDIR /tmp 108 109 RUN wget https://download.01.org/intel-sgx/linux-2.0/sgx_linux_ubuntu16.04.1_x64_sdk_2.0.100.40950.bin \ 110 && chmod +x sgx_linux_ubuntu16.04.1_x64_sdk_2.0.100.40950.bin \ 111 && echo "yes" | ./sgx_linux_ubuntu16.04.1_x64_sdk_2.0.100.40950.bin\ 112 && . /tmp/sgxsdk/environment \ 113 && export SGXSDKInstallPath=/tmp/sgxsdk/ \ 114 && export POET_ENCLAVE_PEM=/tmp/sgxsdk/SampleCode/SampleEnclave/Enclave/Enclave_private.pem \ 115 && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/project/consensus/poet/sgx 116 117 COPY --from=poet-common-builder /project/consensus/poet/python3-sawtooth-poet-common*.deb /tmp 118 COPY --from=ias-client-builder /project/utility/python3-sawtooth-ias-client*.deb /tmp 119 120 RUN dpkg -i /tmp/python3-sawtooth-*.deb || true \ 121 && apt-get -f -y install 122 123 COPY . /project 124 125 RUN export SGXSDKInstallPath=/tmp/sgxsdk/ \ 126 && if [ -z ${POET_ENCLAVE_PEM+x} ]; then \ 127 export POET_ENCLAVE_PEM=/tmp/sgxsdk/SampleCode/SampleEnclave/Enclave/Enclave_private.pem; \ 128 fi \ 129 && cd /project/consensus/poet/sgx \ 130 && python3 setup.py clean --all \ 131 && python3 setup.py --command-packages=stdeb.command debianize \ 132 && if [ -d "packaging/ubuntu" ]; then cp -R packaging/ubuntu/* debian/; fi \ 133 && dpkg-buildpackage -b -rfakeroot -us -uc 134 135 # -------------=== poet sgx docker build ===------------- 136 FROM ubuntu:xenial 137 138 COPY --from=poet-common-builder /project/consensus/poet/python3-sawtooth-poet-common*.deb /tmp 139 COPY --from=ias-client-builder /project/utility/python3-sawtooth-ias-client*.deb /tmp 140 COPY --from=poet-sgx-builder /project/consensus/poet/python3-sawtooth-poet-sgx*.deb /tmp 141 142 RUN echo "deb http://repo.sawtooth.me/ubuntu/ci xenial universe" >> /etc/apt/sources.list \ 143 && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD \ 144 || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) \ 145 && apt-get update \ 146 && dpkg -i /tmp/python3-sawtooth-*.deb || true \ 147 && apt-get -f -y install \ 148 && apt-get clean \ 149 && rm -rf /var/lib/apt/lists/*