Add Dockerfile for Ubuntu 18.04
This commit is contained in:
parent
295d52fbe8
commit
449ba1d5d9
13
Makefile
13
Makefile
@ -6,9 +6,20 @@ githooks:
|
||||
@find .git/hooks -type l -exec rm {} \; && find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \;
|
||||
@echo "Add Git hooks that check Rust code format issues before commits and pushes"
|
||||
|
||||
GIT_MIN_VERSION := 2.11.0
|
||||
GIT_CURRENT_VERSION := $(shell git --version | sed 's/[^0-9.]*//g')
|
||||
GIT_NEED_PROGRESS := $(shell /bin/echo -e "$(GIT_MIN_VERSION)\n$(GIT_CURRENT_VERSION)" \
|
||||
| sort -V | head -n1 | grep -q $(GIT_MIN_VERSION) && echo "true" || echo "false")
|
||||
# If git version >= min_version, append the `--progress` option to show progress status
|
||||
ifeq ($(GIT_NEED_PROGRESS), true)
|
||||
GIT_OPTION := --progress
|
||||
else
|
||||
GIT_OPTION :=
|
||||
endif
|
||||
|
||||
submodule: githooks
|
||||
git submodule init
|
||||
git submodule update
|
||||
git submodule update $(GIT_OPTION)
|
||||
@# Try to apply the patches. If failed, check if the patches are already applied
|
||||
cd deps/rust-sgx-sdk && git apply ../rust-sgx-sdk.patch >/dev/null 2>&1 || git apply ../rust-sgx-sdk.patch -R --check
|
||||
cd deps/serde-json-sgx && git apply ../serde-json-sgx.patch >/dev/null 2>&1 || git apply ../serde-json-sgx.patch -R --check
|
||||
|
95
tools/docker/Dockerfile.ubuntu18.04
Normal file
95
tools/docker/Dockerfile.ubuntu18.04
Normal file
@ -0,0 +1,95 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
LABEL maintainer="Qing Li <geding.lq@alibaba-inc.com>"
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
|
||||
alien \
|
||||
autoconf \
|
||||
automake \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
expect \
|
||||
g++ \
|
||||
gdb \
|
||||
git-core \
|
||||
jq \
|
||||
kmod \
|
||||
libboost-system-dev \
|
||||
libboost-thread-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libfuse-dev \
|
||||
libjsoncpp-dev \
|
||||
liblog4cpp5-dev \
|
||||
libprotobuf-c0-dev \
|
||||
libprotobuf-dev \
|
||||
libssl-dev \
|
||||
libtool \
|
||||
libxml2-dev \
|
||||
ocaml \
|
||||
ocamlbuild \
|
||||
pkg-config \
|
||||
protobuf-compiler \
|
||||
python \
|
||||
python-pip \
|
||||
sudo \
|
||||
unzip \
|
||||
uuid-dev \
|
||||
vim \
|
||||
wget \
|
||||
zip \
|
||||
&& \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install cpuid tool for tests
|
||||
WORKDIR /tmp
|
||||
RUN wget http://www.etallen.com/cpuid/cpuid-20180519.x86_64.tar.gz && \
|
||||
tar -xf ./cpuid-20180519.x86_64.tar.gz && \
|
||||
cp ./cpuid-20180519/cpuid /usr/bin/ && \
|
||||
rm -rf /tmp/cpuid-20180519*
|
||||
|
||||
# Install SGX SDK
|
||||
WORKDIR /tmp
|
||||
RUN git clone -b sgx_2.7.1_for_occlum https://github.com/occlum/linux-sgx && \
|
||||
mkdir /etc/init && \
|
||||
cd linux-sgx && \
|
||||
./download_prebuilt.sh && \
|
||||
./compile_and_install.sh && \
|
||||
echo 'source /opt/intel/sgxsdk/environment' >> /root/.bashrc && \
|
||||
rm -rf /tmp/linux-sgx
|
||||
|
||||
# Install Rust
|
||||
ENV OCCLUM_RUST_VERSION=nightly-2019-11-25
|
||||
RUN curl https://sh.rustup.rs -sSf | \
|
||||
sh -s -- --default-toolchain ${OCCLUM_RUST_VERSION} -y && \
|
||||
rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git
|
||||
ENV PATH="/root/.cargo/bin:$PATH"
|
||||
|
||||
# Install Occlum toolchain
|
||||
COPY toolchains/gcc/* /tmp/
|
||||
WORKDIR /tmp
|
||||
RUN ./build.sh
|
||||
ENV PATH="/opt/occlum/build/bin:/usr/local/occlum/bin:$PATH"
|
||||
|
||||
# Install the latest version of Occlum
|
||||
WORKDIR /root
|
||||
RUN git clone https://github.com/occlum/occlum && \
|
||||
cd occlum && \
|
||||
make submodule && \
|
||||
make LIBOS_RELEASE=1 && \
|
||||
make install && \
|
||||
cp -r demos /root/demos && \
|
||||
rm -rf /root/occlum
|
||||
|
||||
# Start AESM service automatically
|
||||
#
|
||||
# To do so, we add the script to ~/.bashrc. We cannot use systemd to run AESM
|
||||
# as a "real" service since the pid 1 is not systemd in Docker. So we start
|
||||
# up AESM service when an user login with an interative shell.
|
||||
COPY docker/start_aesm.sh /opt/occlum/
|
||||
RUN echo '/opt/occlum/start_aesm.sh' >> /root/.bashrc
|
||||
|
||||
WORKDIR /root
|
@ -1,10 +1,10 @@
|
||||
# Building Occlum Docker images
|
||||
|
||||
This folder contains scripts and Dockerfiles for users to build the Docker images
|
||||
for Occlum. An Occlum Docker image sets up the development environment for
|
||||
for Occlum. An Occlum Docker image sets up the development environment for
|
||||
Occlum and also gets Occlum preinstalled.
|
||||
|
||||
Currently, two Linux OS distributions are supported: Ubuntu 16.04 and CentOS 7.2.
|
||||
Currently, Three Linux OS distributions are supported: Ubuntu 16.04, Ubuntu 18.04 and CentOS 7.2.
|
||||
|
||||
## How to Build
|
||||
|
||||
@ -12,11 +12,11 @@ To build an Occlum Docker image, run the following command
|
||||
```
|
||||
./build_image.sh <OCCLUM_LABEL> <OS_NAME>
|
||||
```
|
||||
where `<OCCLUM_LABEL>` is an arbitrary string chosen by the user to
|
||||
describe the version of Occlum preinstalled in the Docker image
|
||||
(e.g., "latest", "0.8.0", and "prerelease") and `<OS_NAME>` is the
|
||||
name of the OS distribution that the Docker image is based on.
|
||||
Currently, `<OS_NAME>` must be one of the following values:
|
||||
`ubuntu16.04` and `centos7.2`.
|
||||
where `<OCCLUM_LABEL>` is an arbitrary string chosen by the user to
|
||||
describe the version of Occlum preinstalled in the Docker image
|
||||
(e.g., "latest", "0.9.0", and "prerelease") and `<OS_NAME>` is the
|
||||
name of the OS distribution that the Docker image is based on.
|
||||
Currently, `<OS_NAME>` must be one of the following values:
|
||||
`ubuntu16.04`, `ubuntu18.04` and `centos7.2`.
|
||||
|
||||
The resulting Docker image will have `occlum/occlum:<OCCLUM_LABEL>-<OS_NAME>` as its label.
|
||||
|
@ -15,11 +15,12 @@ USAGE:
|
||||
build_image.sh <OCCLUM_LABEL> <OS_NAME>
|
||||
|
||||
<OCCLUM_LABEL>:
|
||||
An arbitrary string chosen by the user to describe the version of Occlum preinstalled in the Docker image, e.g., "latest", "0.8.0", "prerelease", and etc.
|
||||
An arbitrary string chosen by the user to describe the version of Occlum preinstalled in the Docker image, e.g., "latest", "0.9.0", "prerelease", and etc.
|
||||
|
||||
<OS_NAME>:
|
||||
The name of the OS distribution that the Docker image is based on. Currently, <OS_NAME> must be one of the following values:
|
||||
ubuntu16.04 Use Ubuntu 16.04 as the base image
|
||||
ubuntu18.04 Use Ubuntu 18.04 as the base image
|
||||
centos7.2 Use CentOS 7.2 as the base image
|
||||
|
||||
The resulting Docker image will have "occlum/occlum:<OCCLUM_LABEL>-<OS_NAME>" as its label.
|
||||
@ -36,9 +37,13 @@ fi
|
||||
occlum_label=$1
|
||||
os_name=$2
|
||||
|
||||
if [ "$os_name" != "ubuntu16.04" ] && [ "$os_name" != "centos7.2" ];then
|
||||
report_error
|
||||
fi
|
||||
function check_item_in_list() {
|
||||
item=$1
|
||||
list=$2
|
||||
[[ $list =~ (^|[[:space:]])$item($|[[:space:]]) ]]
|
||||
}
|
||||
|
||||
check_item_in_list "$os_name" "ubuntu16.04 ubuntu18.04 centos7.2" || report_error
|
||||
|
||||
cd "$script_dir/.."
|
||||
docker build -f "$script_dir/Dockerfile.$os_name" -t "occlum/occlum:$occlum_label-$os_name" .
|
||||
|
Loading…
Reference in New Issue
Block a user