[infra] flattening base-clang image

The image has lots of layers with lots of deleted files (sources and intermediates).
Flatten the image to reduce its size.
This commit is contained in:
Mike Aizatsky 2016-10-06 14:57:40 -07:00 committed by GitHub
parent d78f337aeb
commit 9bca6e5bbc
1 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,16 @@
def dockerOptions="--no-cache"
// Flattens all intermediate layers of the image.
// Usefull when image has lots of deleted files.
def flattenDockerImage(image) {
def containerName = image.replaceAll('/', '_') + "-tmp";
sh "echo ${image} ${containerName}"
sh "docker rm -f ${containerName} || true"
sh "docker run --name ${containerName} ${image} /bin/true"
sh "docker export ${containerName} | docker import - ${image}"
}
node {
git url: 'https://github.com/google/oss-fuzz/'
@ -27,6 +37,8 @@ node {
stage name: 'Build ossfuzz/base-clang', concurrency: 1
sh "docker build $dockerOptions -t ossfuzz/base-clang infra/base-images/base-clang"
flattenDockerImage("ossfuzz/base-clang")
stage name: 'Build ossfuzz/base-libfuzzer', concurrency: 1
sh "docker build $dockerOptions -t ossfuzz/base-libfuzzer infra/base-images/base-libfuzzer"