Skip to content

Commit 95e900b

Browse files
authored
Work around python extract tarfile error in encrypted file system (#195)
* Change gramine build type to release to workaround python extract tarfile error in encrypted file system * Fix anolisos image build error && Add usage help for gramine-sgx-dev
1 parent 34e8095 commit 95e900b

File tree

4 files changed

+39
-23
lines changed

4 files changed

+39
-23
lines changed

cczoo/common/docker/gramine/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Execute the following command to build this docker image:
2626
```
2727
base_image=ubuntu:20.04
2828
image_tag=gramine-sgx-dev:v1.2-ubuntu20.04-latest
29-
./build_docker_image.sh ${base_image} ${image_tag}
29+
build_type=release
30+
./build_docker_image.sh ${base_image} ${image_tag} ${build_type}
3031
```
3132

32-
`ubuntu:18.04` and `ubuntu:20.04` could be selected as base_image.
33+
`ubuntu:18.04`, `ubuntu:20.04` and `anolisos` could be selected as base_image.

cczoo/common/docker/gramine/build_docker_image.sh

100644100755
Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,55 @@
1616
#!/bin/bash
1717
set -e
1818

19-
if [ "$1" == "anolisos" ] ; then
19+
function usage_help() {
20+
echo -e "usage_help:"
21+
echo -e ' ./build_docker_image.sh ${base_image} ${image_tag} ${build_type}'
22+
echo -e " {base_image}"
23+
echo -e " ubuntu:18.04 | ubuntu20.04 | anolisos"
24+
echo -e " {image_tag}"
25+
echo -e " customed image tag"
26+
echo -e " {build_type}"
27+
echo -e " release | debug"
28+
}
29+
30+
usage_help
31+
32+
if [ -n "$1" ] ; then
2033
base_image=$1
2134
else
2235
base_image=ubuntu:20.04
23-
2436
fi
2537

26-
if [ -n "$2" ] ; then
38+
if [ "$2" == "anolisos" ] ; then
39+
image_tag=gramine-sgx-dev:v1.2-anolisos
40+
elif [ -n "$2" ] ; then
2741
image_tag=$2
2842
else
2943
image_tag=gramine-sgx-dev:v1.2-ubuntu20.04-latest
3044
fi
3145

46+
if [ -n "$3" ] ; then
47+
build_type=$3
48+
else
49+
build_type=release
50+
fi
51+
3252
# You can remove no_proxy and proxy_server if your network doesn't need it
3353
no_proxy="localhost,127.0.0.1"
34-
proxy_server="" # your http proxy server
54+
# proxy_server="" # your http proxy server
3555

3656
cd `dirname $0`
3757

38-
if [ ${base_image} == "anolisos" ] ; then
58+
if [ "${base_image}" == "anolisos" ] ; then
3959
DOCKER_BUILDKIT=0 docker build \
4060
--build-arg no_proxy=${no_proxy} \
4161
--build-arg http_proxy=${proxy_server} \
4262
--build-arg https_proxy=${proxy_server} \
4363
--build-arg base_image=${base_image} \
4464
--build-arg BASE_IMAGE=${base_image} \
65+
--build-arg BUILD_TYPE=${build_type} \
4566
-f gramine-sgx-dev:v1.2-anolisos.dockerfile \
46-
-t gramine-sgx-dev:v1.2-anolisos \
67+
-t ${image_tag} \
4768
.
4869
else
4970
DOCKER_BUILDKIT=0 docker build \
@@ -52,8 +73,9 @@ DOCKER_BUILDKIT=0 docker build \
5273
--build-arg https_proxy=${proxy_server} \
5374
--build-arg base_image=${base_image} \
5475
--build-arg BASE_IMAGE=${base_image} \
76+
--build-arg BUILD_TYPE=${build_type} \
5577
-f gramine-sgx-dev.dockerfile \
56-
-t gramine-sgx-dev:v1.2-ubuntu20.04-latest \
78+
-t ${image_tag} \
5779
.
5880
fi
5981
cd -

cczoo/common/docker/gramine/gramine-sgx-dev.dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ RUN apt-get install -y bison gawk nasm python3-click python3-jinja2 ninja-build
7676
libgmp-dev libmpfr-dev libmpc-dev libisl-dev
7777

7878
RUN pip3 install --upgrade pip \
79-
&& pip3 install toml meson
79+
&& pip3 install toml meson cryptography
8080

8181
RUN git clone https://github.com/gramineproject/gramine.git ${GRAMINEDIR} \
8282
&& cd ${GRAMINEDIR} \
@@ -89,10 +89,11 @@ RUN git clone https://github.com/intel/SGXDataCenterAttestationPrimitives.git ${
8989
# COPY gramine/patches ${GRAMINEDIR}
9090
# RUN cd ${GRAMINEDIR} \
9191
# && git apply *.diff
92-
9392
# RUN openssl genrsa -3 -out ${SGX_SIGNER_KEY} 3072
93+
94+
ARG BUILD_TYPE=release
9495
RUN cd ${GRAMINEDIR} \
95-
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=debug -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
96+
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=${BUILD_TYPE} -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
9697
&& LD_LIBRARY_PATH="" ninja -C build/ \
9798
&& LD_LIBRARY_PATH="" ninja -C build/ install
9899

@@ -122,14 +123,6 @@ RUN gramine-sgx-gen-private-key
122123

123124
COPY configs /
124125

125-
RUN gramine-sgx-gen-private-key
126-
127-
COPY configs /
128-
129-
RUN gramine-sgx-gen-private-key
130-
131-
COPY configs /
132-
133126
# Use it to ignore packages authenticate in apt-get
134127
# ENV apt_arg="-o Acquire::AllowInsecureRepositories=true \
135128
# -o Acquire::AllowDowngradeToInsecureRepositories=true"

cczoo/common/docker/gramine/gramine-sgx-dev:v1.2-anolisos.dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN mkdir /opt/intel && cd /opt/intel \
3434
&& sha256sum sgx_rpm_local_repo.tar.gz \
3535
&& tar xvf sgx_rpm_local_repo.tar.gz \
3636
&& yum-config-manager --add-repo file:///opt/intel/sgx_rpm_local_repo \
37-
&& yum -y --nogpgcheck install libsgx-urts libsgx-launch libsgx-epid libsgx-quote-ex libsgx-dcap-ql libsgx-uae-service libsgx-dcap-quote-verify-devel
37+
&& yum -y --nogpgcheck install libsgx-urts libsgx-launch libsgx-epid libsgx-quote-ex libsgx-dcap-ql libsgx-uae-service libsgx-dcap-quote-verify-devel \
3838
&& yum -y groupinstall 'Development Tools'
3939

4040
# COPY patches/libsgx_dcap_quoteverify.so /usr/lib64/
@@ -67,9 +67,9 @@ RUN git clone https://github.com/intel/SGXDataCenterAttestationPrimitives.git ${
6767
&& cd ${ISGX_DRIVER_PATH} \
6868
&& git checkout ${SGX_DCAP_VERSION}
6969

70-
ENV LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${INSTALL_PREFIX}/lib64:${LD_LIBRARY_PATH}
70+
ARG BUILD_TYPE=release
7171
RUN cd ${GRAMINEDIR} \
72-
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=debug -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
72+
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=${BUILD_TYPE} -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
7373
&& LD_LIBRARY_PATH="" ninja -C build/ \
7474
&& LD_LIBRARY_PATH="" ninja -C build/ install
7575
RUN gramine-sgx-gen-private-key

0 commit comments

Comments
 (0)