Bladeren bron

Tools/gsce: Clean up and optimize the integration of docker container and graphene-SGX

The dockerfile instruction RUN will create new layers
when it is executed, original codes will increase the size of
the final image and causes potential cache issues.
So we need to employ shell tricks to keep the layers as small as possible.

The detail:
https://docs.docker.com/v17.09/engine/userguide/eng-image/dockerfile_best-practices

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Zhang Chen 5 jaren geleden
bovenliggende
commit
1c78c43c92
1 gewijzigde bestanden met toevoegingen van 11 en 12 verwijderingen
  1. 11 12
      Tools/gsce

+ 11 - 12
Tools/gsce

@@ -22,23 +22,22 @@ def gen_dockerfile( image_name, app_name, bin_name, proj_dir) :
  
   # DOWNLOAD dependencies
   df.write('# Download dependencies\n')
-  df.write('RUN apt-get update && \ \n')
-  df.write('    apt-get install -y openssl libjemalloc-dev python python-pip python-dev \n')
-  df.write('RUN pip install protobuf && \ \n')
-  df.write('    pip install pycrypto\n')
+  df.write('RUN apt-get update \\\n')
+  df.write('    && apt-get install -y openssl libjemalloc-dev python python-pip python-dev \\\n')
+  df.write('    && pip install protobuf \\\n')
+  df.write('    && pip install pycrypto \n')
 
   df.write('# Temporal fixes for Dependencies Issue #1: libcrypto.so.1.0.0 and libssl.so.1.0.0 have different locations \n')
-  df.write('RUN ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 && \ \n')
-  df.write('    ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so.1.0.0 \n')
-  
+  df.write('RUN ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 \\\n')
+  df.write('    && ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so.1.0.0 \n')
+
   # SETUP Directory Structure
   print "cwd: "+ proj_dir
   df.write('# Setup Directory Structure \n')
- # df.write('RUN mkdir -p ' + proj_dir + '\n')
-  df.write('RUN mkdir -p ' + proj_dir + '/LibOS/shim/test/apps/' + app_name + '\n')
-  df.write('RUN mkdir -p ' + proj_dir + '/Pal/src/host/Linux-SGX/signer \n')
-  df.write('RUN mkdir -p ' + proj_dir + '/Runtime \n')
-  df.write('RUN mkdir /gbin \n')
+  df.write('RUN mkdir -p ' + proj_dir + '/LibOS/shim/test/apps/' + app_name + ' \\\n')
+  df.write('    && mkdir -p ' + proj_dir + '/Pal/src/host/Linux-SGX/signer \\\n')
+  df.write('    && mkdir -p ' + proj_dir + '/Runtime \\\n')
+  df.write('    && mkdir /gbin \n')
 
   # COPY system files
   df.write('# Copy system files \n')