Slim down docker image using slimtoolkit/slim
Change-Id: I6b3d96d5bfc4f7e59e5f897d19717d4dcfcbddf2
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 729c300..d67231c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -45,12 +45,26 @@
VID_ALT: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
VID: snapshot
stage: build-docker-image
+ cache:
+ key: korap
+ paths:
+ - cache/
before_script:
+ - mkdir -p cache
- apk update
- apk add --no-cache git
+ - >
+ apk add -u curl
+ && curl -L -o ds.tar.gz https://downloads.dockerslim.com/releases/1.40.6/dist_linux.tar.gz
+ && tar -xvf ds.tar.gz
+ && mv dist_linux/* /usr/local/bin/
script:
- docker build -f Dockerfile -t korap/corpuscomposition:$VID .
- - docker save korap/corpuscomposition:$VID | xz -T0 -M16G -9 > corpuscomposition-$VID.xz
+ - docker run -d --rm --name corpuscomposition korap/corpuscomposition:$VID
+ - docker cp corpuscomposition:/cache ./
+ - docker kill corpuscomposition
+ - slim build --sensor-ipc-mode proxy --http-probe-off --include-path /usr/local --include-path /cache korap/corpuscomposition
+ - docker save korap/corpuscomposition.slim | xz -T0 > corpuscomposition-$VID.xz
artifacts:
paths:
- corpuscomposition-$VID.xz