forked from integritee-network/substraTEE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·95 lines (80 loc) · 3 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
# Copyright 2020 Supercomputing Systems AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Generic Dockerfile for Intel SGX development and CI machines
# Based on Ubuntu
# Intel SGX SDK and PSW installed
# Rust-sgx-sdk installed
# IPFS installed
# Use the script 'docker_build.sh' to build the docker image
# The docker image can be downloaded from
# https://hub.docker.com/repository/docker/scssubstratee/substratee_dev/
ARG VERSION_UBUNTU
ARG VERSION_RUST_SGX_SDK
FROM baiduxlab/sgx-rust:$VERSION_UBUNTU-$VERSION_RUST_SGX_SDK as development
ARG VERSION_IPFS
RUN echo "VERSION_IPFS = ${VERSION_IPFS}"
SHELL ["/bin/bash", "-c"]
# install rsync
RUN apt-get update && \
apt-get install -y --no-install-recommends \
rsync && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/*
# install ipfs
RUN mkdir -p /ipfs && \
cd /ipfs && \
wget -O go-ipfs.tar.gz https://dist.ipfs.io/go-ipfs/v${VERSION_IPFS}/go-ipfs_v${VERSION_IPFS}_linux-amd64.tar.gz && \
tar xvfz go-ipfs.tar.gz && \
cd go-ipfs && \
./install.sh
# install packages needed for substrate
RUN apt-get update && \
apt-get install -y cmake pkg-config libssl-dev git gcc build-essential clang libclang-dev && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/*
# install LLVM to compile ring into WASM
RUN apt-get update && \
wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
sudo ./llvm.sh 10 && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/*
# install additional tools
RUN apt-get update && \
apt-get install -y tmux nano && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/*
ARG USER_ID
ARG GROUP_ID
RUN addgroup --gid $GROUP_ID devadmin
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID devadmin
# make add user to sudoer
RUN adduser devadmin sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER devadmin
ENV HOME /home/devadmin
WORKDIR $HOME
# install rust as the current user
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# install WASM toolchain
RUN $HOME/.cargo/bin/rustup target install wasm32-unknown-unknown
# set environment variables
ENV DEBIAN_FRONTEND noninteractive
ENV TERM xterm
ENV SGX_SDK /opt/sgxsdk
ENV PATH "$PATH:${SGX_SDK}/bin:${SGX_SDK}/bin/x64:${HOME}/.cargo/bin"
ENV PKG_CONFIG_PATH "${PKG_CONFIG_PATH}:${SGX_SDK}/pkgconfig"
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:${SGX_SDK}/sdk_libs"
ENV CC /usr/bin/clang-10
ENV AR /usr/bin/llvm-ar-10